Skip to content

Commit d3f5333

Browse files
committed
changed ML-DSA/SLH-DSA Jca signatures to return null if default 0 length context is used, relates to github #1946.
1 parent 185cf12 commit d3f5333

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/util/BaseDeterministicOrRandomSignature.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ protected final AlgorithmParameters engineGetParameters()
162162
{
163163
if (engineParams == null)
164164
{
165-
if (paramSpec != null)
165+
if (paramSpec != null && paramSpec != ContextParameterSpec.EMPTY_CONTEXT_SPEC)
166166
{
167167
try
168168
{

prov/src/test/java/org/bouncycastle/pqc/jcajce/provider/test/MLDSATest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,8 @@ public void testHashMLDSAKATSig()
531531
assertTrue(sig.verify(genS));
532532

533533
AlgorithmParameters algP = sig.getParameters();
534-
535-
ContextParameterSpec cSpec = algP.getParameterSpec(ContextParameterSpec.class);
536-
537-
assertTrue(Arrays.areEqual(new byte[0], cSpec.getContext()));
534+
535+
assertTrue(null == algP);
538536

539537
// test using ml-dsa-44 for the key, should be the same.
540538

0 commit comments

Comments
 (0)