summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-08-04 14:26:45 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-08-04 14:26:45 +0700
commitf948a496ea7905d2282e8f4a0be41c4ca93f2d0b (patch)
tree31bbdeb8ebce99f8009ce8174e52d582e9d6aed8 /crypto/src
parentReplace some locks with singleton init (diff)
downloadBouncyCastle.NET-ed25519-f948a496ea7905d2282e8f4a0be41c4ca93f2d0b.tar.xz
Added handling of L=1 in GenerateLmsContext()
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/pqc/crypto/lms/HSSPublicKeyParameters.cs6
1 files changed, 5 insertions, 1 deletions
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);
         }