Skip to content

Commit 7f1ca8b

Browse files
committed
Fix potential NPE
1 parent eb9e2bd commit 7f1ca8b

File tree

1 file changed

+6
-3
lines changed
  • prov/src/main/java/org/bouncycastle/pqc/jcajce/provider/util

1 file changed

+6
-3
lines changed

prov/src/main/java/org/bouncycastle/pqc/jcajce/provider/util/KdfUtil.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,19 @@ public class KdfUtil
3434
*/
3535
public static byte[] makeKeyBytes(KEMKDFSpec kdfSpec, byte[] secret)
3636
{
37-
byte[] keyBytes = null;
37+
byte[] keyBytes;
3838
try
3939
{
4040
if (kdfSpec == null)
4141
{
4242
keyBytes = new byte[secret.length];
4343
System.arraycopy(secret, 0, keyBytes, 0, keyBytes.length);
4444
}
45-
46-
keyBytes = makeKeyBytes(kdfSpec.getKdfAlgorithm(), secret, kdfSpec.getOtherInfo(), kdfSpec.getKeySize());
45+
else
46+
{
47+
keyBytes = makeKeyBytes(kdfSpec.getKdfAlgorithm(), secret, kdfSpec.getOtherInfo(),
48+
kdfSpec.getKeySize());
49+
}
4750
}
4851
finally
4952
{

0 commit comments

Comments
 (0)