@@ -176,20 +176,25 @@ class ECDSASignatureAlgorithmInstance extends SignatureAlgorithmInstance instanc
176176}
177177
178178/**
179- * LMS signers .
179+ * An LMS or HSS stateful hash-based signer .
180180 */
181- class LMSSignatureAlgorithmInstance extends SignatureAlgorithmInstance instanceof ClassInstanceExpr {
182- LMSSignatureAlgorithmInstance ( ) {
181+ class StatefulSignatureAlgorithmInstance extends SignatureAlgorithmInstance instanceof ClassInstanceExpr
182+ {
183+ StatefulSignatureAlgorithmInstance ( ) {
183184 super .getConstructedType ( ) instanceof Signers:: Signer and
184- super .getConstructedType ( ) .getName ( ) .matches ( "LMS%" )
185+ super .getConstructedType ( ) .getName ( ) .matches ( [ "LMS%" , "HSS%" ] )
185186 }
186187
187188 override string getRawAlgorithmName ( ) {
188189 typeNameToRawAlgorithmName ( super .getConstructedType ( ) .getName ( ) , result )
189190 }
190191
191192 override Crypto:: KeyOpAlg:: Algorithm getAlgorithmType ( ) {
193+ super .getConstructedType ( ) .getName ( ) .matches ( "LMS%" ) and
192194 result = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: LMS ( ) )
195+ or
196+ super .getConstructedType ( ) .getName ( ) .matches ( "HSS%" ) and
197+ result = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: HSS ( ) )
193198 }
194199}
195200
@@ -307,25 +312,26 @@ class GenericEllipticCurveKeyGenerationAlgorithmInstance extends KeyGenerationAl
307312}
308313
309314/**
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.
315317 */
316- class LMSKeyGenerationAlgorithmInstance extends KeyGenerationAlgorithmInstance instanceof ClassInstanceExpr
318+ class StatefulSignatureKeyGenerationAlgorithmInstance extends KeyGenerationAlgorithmInstance instanceof ClassInstanceExpr
317319{
318- LMSKeyGenerationAlgorithmInstance ( ) {
320+ StatefulSignatureKeyGenerationAlgorithmInstance ( ) {
319321 super .getConstructedType ( ) instanceof Generators:: KeyGenerator and
320- super .getConstructedType ( ) .getName ( ) .matches ( "LMS%" )
322+ super .getConstructedType ( ) .getName ( ) .matches ( [ "LMS%" , "HSS%" ] )
321323 }
322324
323325 override string getRawAlgorithmName ( ) {
324326 typeNameToRawAlgorithmName ( super .getConstructedType ( ) .getName ( ) , result )
325327 }
326328
327329 override Crypto:: KeyOpAlg:: Algorithm getAlgorithmType ( ) {
330+ super .getConstructedType ( ) .getName ( ) .matches ( "LMS%" ) and
328331 result = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: LMS ( ) )
332+ or
333+ super .getConstructedType ( ) .getName ( ) .matches ( "HSS%" ) and
334+ result = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: HSS ( ) )
329335 }
330336}
331337
@@ -336,11 +342,11 @@ bindingset[typeName]
336342private predicate typeNameToRawAlgorithmName ( string typeName , string algorithmName ) {
337343 // Ed25519, Ed25519ph, and Ed25519ctx key generators and signers
338344 typeName .matches ( "Ed25519%" ) and
339- algorithmName = "ED25519 "
345+ algorithmName = "Ed25519 "
340346 or
341347 // Ed448 and Ed448ph key generators and signers
342348 typeName .matches ( "Ed448%" ) and
343- algorithmName = "ED448 "
349+ algorithmName = "Ed448 "
344350 or
345351 // ECDSA
346352 typeName .matches ( "ECDSA%" ) and
@@ -349,28 +355,32 @@ private predicate typeNameToRawAlgorithmName(string typeName, string algorithmNa
349355 // LMS
350356 typeName .matches ( "LMS%" ) and
351357 algorithmName = "LMS"
358+ or
359+ // HSS
360+ typeName .matches ( "HSS%" ) and
361+ algorithmName = "HSS"
352362}
353363
354364private predicate signatureNameToKeySizeAndAlgorithmMapping (
355365 string name , int keySize , Crypto:: KeyOpAlg:: Algorithm algorithm
356366) {
357- name = "ED25519 " and
367+ name = "Ed25519 " and
358368 keySize = 256 and
359369 algorithm = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: Ed25519 ( ) )
360370 or
361- name = "ED448 " and
371+ name = "Ed448 " and
362372 keySize = 448 and
363373 algorithm = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: Ed448 ( ) )
364374}
365375
366376private predicate generatorNameToKeySizeAndAlgorithmMapping (
367377 string name , int keySize , Crypto:: KeyOpAlg:: Algorithm algorithm
368378) {
369- name = "ED25519 " and
379+ name = "Ed25519 " and
370380 keySize = 256 and
371381 algorithm = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: Ed25519 ( ) )
372382 or
373- name = "ED448 " and
383+ name = "Ed448 " and
374384 keySize = 448 and
375385 algorithm = Crypto:: KeyOpAlg:: TSignature ( Crypto:: KeyOpAlg:: Ed448 ( ) )
376386}
0 commit comments