Skip to content

Commit 2418e7f

Browse files
committed
added arg checks, fixed typo in MLKEM test (checking wrong algorithm name)
1 parent c7ece0f commit 2418e7f

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/mlkem/MLKEMCipherSpi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.bouncycastle.util.Exceptions;
3535

3636
class MLKEMCipherSpi
37-
extends CipherSpi
37+
extends CipherSpi
3838
{
3939
private final String algorithmName;
4040
private MLKEMGenerator kemGen;

prov/src/main/java/org/bouncycastle/jcajce/spec/KTSParameterSpec.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ public Builder withNoKdf()
8888
*/
8989
public Builder withKdfAlgorithm(AlgorithmIdentifier kdfAlgorithm)
9090
{
91+
if (kdfAlgorithm == null)
92+
{
93+
throw new NullPointerException("kdfAlgorithm cannot be null");
94+
}
95+
9196
this.kdfAlgorithm = kdfAlgorithm;
9297

9398
return this;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private void performKEMScipher(KeyPair kp, String algorithm, KTSParameterSpec kt
124124
Cipher w1 = Cipher.getInstance(algorithm, "BC");
125125

126126
byte[] keyBytes;
127-
if (algorithm.endsWith("KWP"))
127+
if (ktsParameterSpec.getKeyAlgorithmName().endsWith("KWP"))
128128
{
129129
keyBytes = Hex.decode("000102030405060708090a0b0c0d0e0faa");
130130
}

0 commit comments

Comments
 (0)