From f948a496ea7905d2282e8f4a0be41c4ca93f2d0b Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 4 Aug 2023 14:26:45 +0700 Subject: Added handling of L=1 in GenerateLmsContext() --- crypto/src/pqc/crypto/lms/HSSPublicKeyParameters.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crypto/src/pqc') diff --git a/crypto/src/pqc/crypto/lms/HSSPublicKeyParameters.cs b/crypto/src/pqc/crypto/lms/HSSPublicKeyParameters.cs index 85b781228..01bac93b8 100644 --- a/crypto/src/pqc/crypto/lms/HSSPublicKeyParameters.cs +++ b/crypto/src/pqc/crypto/lms/HSSPublicKeyParameters.cs @@ -96,7 +96,11 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms } LmsSignedPubKey[] signedPubKeys = signature.GetSignedPubKeys(); - LmsPublicKeyParameters key = signedPubKeys[signedPubKeys.Length - 1].GetPublicKey(); + LmsPublicKeyParameters key = LmsPublicKey; + if (signedPubKeys.Length != 0) + { + key = signedPubKeys[signedPubKeys.Length - 1].GetPublicKey(); + } return key.GenerateOtsContext(signature.Signature).WithSignedPublicKeys(signedPubKeys); } -- cgit 1.4.1