@@ -176,20 +176,25 @@ class ECDSASignatureAlgorithmInstance extends SignatureAlgorithmInstance instanc
176
176
}
177
177
178
178
/**
179
- * LMS signers .
179
+ * An LMS or HSS stateful hash-based signer .
180
180
*/
181
- class LMSSignatureAlgorithmInstance extends SignatureAlgorithmInstance instanceof ClassInstanceExpr {
182
- LMSSignatureAlgorithmInstance ( ) {
181
+ class StatefulSignatureAlgorithmInstance extends SignatureAlgorithmInstance instanceof ClassInstanceExpr
182
+ {
183
+ StatefulSignatureAlgorithmInstance ( ) {
183
184
super .getConstructedType ( ) instanceof Signers:: Signer and
184
- super .getConstructedType ( ) .getName ( ) .matches ( "LMS%" )
185
+ super .getConstructedType ( ) .getName ( ) .matches ( [ "LMS%" , "HSS%" ] )
185
186
}
186
187
187
188
override string getRawAlgorithmName ( ) {
188
189
typeNameToRawAlgorithmName ( super .getConstructedType ( ) .getName ( ) , result )
189
190
}
190
191
191
192
override Crypto:: KeyOpAlg:: Algorithm getAlgorithmType ( ) {
193
+ super .getConstructedType ( ) .getName ( ) .matches ( "LMS%" ) and
192
194
result = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: LMS ( ) )
195
+ or
196
+ super .getConstructedType ( ) .getName ( ) .matches ( "HSS%" ) and
197
+ result = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: HSS ( ) )
193
198
}
194
199
}
195
200
@@ -307,25 +312,26 @@ class GenericEllipticCurveKeyGenerationAlgorithmInstance extends KeyGenerationAl
307
312
}
308
313
309
314
/**
310
- * Represents LMS key generation instances. The algorithm is implicitly defined
311
- * by the type.
312
- *
313
- * TODO: Determine how to represent LMS parameters, such as the hash function
314
- * and the tree height.
315
+ * Represents LMS or HSS key generation instances. The algorithm is implicitly
316
+ * defined by the type.
315
317
*/
316
- class LMSKeyGenerationAlgorithmInstance extends KeyGenerationAlgorithmInstance instanceof ClassInstanceExpr
318
+ class StatefulSignatureKeyGenerationAlgorithmInstance extends KeyGenerationAlgorithmInstance instanceof ClassInstanceExpr
317
319
{
318
- LMSKeyGenerationAlgorithmInstance ( ) {
320
+ StatefulSignatureKeyGenerationAlgorithmInstance ( ) {
319
321
super .getConstructedType ( ) instanceof Generators:: KeyGenerator and
320
- super .getConstructedType ( ) .getName ( ) .matches ( "LMS%" )
322
+ super .getConstructedType ( ) .getName ( ) .matches ( [ "LMS%" , "HSS%" ] )
321
323
}
322
324
323
325
override string getRawAlgorithmName ( ) {
324
326
typeNameToRawAlgorithmName ( super .getConstructedType ( ) .getName ( ) , result )
325
327
}
326
328
327
329
override Crypto:: KeyOpAlg:: Algorithm getAlgorithmType ( ) {
330
+ super .getConstructedType ( ) .getName ( ) .matches ( "LMS%" ) and
328
331
result = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: LMS ( ) )
332
+ or
333
+ super .getConstructedType ( ) .getName ( ) .matches ( "HSS%" ) and
334
+ result = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: HSS ( ) )
329
335
}
330
336
}
331
337
@@ -336,11 +342,11 @@ bindingset[typeName]
336
342
private predicate typeNameToRawAlgorithmName ( string typeName , string algorithmName ) {
337
343
// Ed25519, Ed25519ph, and Ed25519ctx key generators and signers
338
344
typeName .matches ( "Ed25519%" ) and
339
- algorithmName = "ED25519 "
345
+ algorithmName = "Ed25519 "
340
346
or
341
347
// Ed448 and Ed448ph key generators and signers
342
348
typeName .matches ( "Ed448%" ) and
343
- algorithmName = "ED448 "
349
+ algorithmName = "Ed448 "
344
350
or
345
351
// ECDSA
346
352
typeName .matches ( "ECDSA%" ) and
@@ -349,28 +355,32 @@ private predicate typeNameToRawAlgorithmName(string typeName, string algorithmNa
349
355
// LMS
350
356
typeName .matches ( "LMS%" ) and
351
357
algorithmName = "LMS"
358
+ or
359
+ // HSS
360
+ typeName .matches ( "HSS%" ) and
361
+ algorithmName = "HSS"
352
362
}
353
363
354
364
private predicate signatureNameToKeySizeAndAlgorithmMapping (
355
365
string name , int keySize , Crypto:: KeyOpAlg:: Algorithm algorithm
356
366
) {
357
- name = "ED25519 " and
367
+ name = "Ed25519 " and
358
368
keySize = 256 and
359
369
algorithm = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: Ed25519 ( ) )
360
370
or
361
- name = "ED448 " and
371
+ name = "Ed448 " and
362
372
keySize = 448 and
363
373
algorithm = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: Ed448 ( ) )
364
374
}
365
375
366
376
private predicate generatorNameToKeySizeAndAlgorithmMapping (
367
377
string name , int keySize , Crypto:: KeyOpAlg:: Algorithm algorithm
368
378
) {
369
- name = "ED25519 " and
379
+ name = "Ed25519 " and
370
380
keySize = 256 and
371
381
algorithm = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: Ed25519 ( ) )
372
382
or
373
- name = "ED448 " and
383
+ name = "Ed448 " and
374
384
keySize = 448 and
375
385
algorithm = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: Ed448 ( ) )
376
386
}
0 commit comments