Skip to content

Commit 778c040

Browse files
committed
Java 4, Java 5 compatibility changes. Minor cleanups.
1 parent c70e8cd commit 778c040

File tree

30 files changed

+585
-650
lines changed

30 files changed

+585
-650
lines changed

ant/jdk14.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<exclude name="**/rainbow/*.java"/>
3232
<exclude name="**/Rainbow*.java"/>
3333
<exclude name="**/PhotonBeetle*.java"/>
34-
<exclude name="**/ISAP*.java"/>
34+
<exclude name="**/ISAPEngine*.java"/>
3535
<exclude name="**/Xoodyak*.java"/>
3636
<exclude name="**/Elephant*.java"/>
3737
<exclude name="**/Sparkle*.java"/>
@@ -45,6 +45,8 @@
4545
<fileset dir="pkix/src/main/java">
4646
<exclude name="**/JceAADStream.java"/>
4747
<exclude name="**/JceKeyTransAuthEnvelopedRecipient.java"/>
48+
<exclude name="**/BcHssLmsContentSignerB*.java"/>
49+
<exclude name="**/BcHssLmsContentVerifierProviderBuilder.java"/>
4850
<exclude name="**/its/**/*.java"/>
4951
<exclude name="**/est/**/*.java"/>
5052
<exclude name="**/pkix/jcajce/*.java"/>

bc-build.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# intended to hold user-specific settings that are *not* committed to
44
# the repository.
55

6-
release.suffix: 1.80
7-
release.name: 1.80
8-
release.version: 1.80
6+
release.suffix: 1.81
7+
release.name: 1.81
8+
release.version: 1.81
99
release.debug: false
1010

1111
mail.jar.home: ./libs/javax.mail-1.4.7.jar

core/src/main/java/org/bouncycastle/crypto/kems/SAKKEKEMSGenerator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package org.bouncycastle.crypto.kems;
22

3+
import java.math.BigInteger;
4+
import java.security.SecureRandom;
5+
36
import org.bouncycastle.crypto.Digest;
47
import org.bouncycastle.crypto.EncapsulatedSecretGenerator;
58
import org.bouncycastle.crypto.SecretWithEncapsulation;
@@ -10,9 +13,6 @@
1013
import org.bouncycastle.util.Arrays;
1114
import org.bouncycastle.util.BigIntegers;
1215

13-
import java.math.BigInteger;
14-
import java.security.SecureRandom;
15-
1616
/**
1717
* This class implements the SAKKE (Sakai-Kasahara Key Encryption) Key Encapsulation Mechanism
1818
* as defined in RFC 6508. It generates an encapsulated shared secret value (SSV) using
@@ -146,7 +146,7 @@ static BigInteger hashToIntegerRange(byte[] input, BigInteger q, Digest digest)
146146
// Step 1: Compute A = hashfn(s)
147147
digest.update(input, 0, input.length);
148148
digest.doFinal(hash, 0);
149-
byte[] A = hash.clone();
149+
byte[] A = Arrays.clone(hash);
150150

151151
// Step 2: Initialize h_0 to all-zero bytes of hashlen size
152152
byte[] h = new byte[digest.getDigestSize()];

core/src/main/java/org/bouncycastle/pqc/crypto/snova/SnovaEngine.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.bouncycastle.crypto.params.ParametersWithIV;
1212
import org.bouncycastle.util.Arrays;
1313
import org.bouncycastle.util.GF16;
14+
import org.bouncycastle.util.Integers;
1415
import org.bouncycastle.util.Pack;
1516

1617
class SnovaEngine
@@ -39,7 +40,7 @@ public SnovaEngine(SnovaParameters params)
3940
this.o = params.getO();
4041
this.alpha = params.getAlpha();
4142
this.n = params.getN();
42-
if (!xSSet.containsKey(l))
43+
if (!xSSet.containsKey(Integers.valueOf(l)))
4344
{
4445
byte[][] S = new byte[l][lsq];
4546
int[][] xS = new int[l][lsq];
@@ -57,12 +58,12 @@ public SnovaEngine(SnovaParameters params)
5758
xS[index][ij] = GF16Utils.gf16FromNibble(S[index][ij]);
5859
}
5960
}
60-
sSet.put(l, S);
61-
xSSet.put(l, xS);
61+
sSet.put(Integers.valueOf(l), S);
62+
xSSet.put(Integers.valueOf(l), xS);
6263
}
63-
S = sSet.get(l);
64-
xS = xSSet.get(l);
65-
if (l < 4 && !fixedAbqSet.containsKey(o))
64+
S = (byte[][])sSet.get(Integers.valueOf(l));
65+
xS = (int[][])xSSet.get(Integers.valueOf(l));
66+
if (l < 4 && !fixedAbqSet.containsKey(Integers.valueOf(o)))
6667
{
6768
int alphaxl = alpha * l;
6869
int alphaxlsq = alphaxl * l;
@@ -88,7 +89,7 @@ public SnovaEngine(SnovaParameters params)
8889
genAFqS(q12, oxalphaxl + axl, fixedAbq, (oxalphaxlsq << 1) + oxalphaxlsq + axlsq);
8990
}
9091
}
91-
fixedAbqSet.put(o, fixedAbq);
92+
fixedAbqSet.put(Integers.valueOf(o), fixedAbq);
9293
}
9394
}
9495

@@ -564,7 +565,7 @@ public void genABQP(MapGroup1 map1, byte[] pkSeed)
564565
else
565566
{
566567
int oxalphaxlsq = o * alpha * lsq;
567-
byte[] fixedAbq = fixedAbqSet.get(o);
568+
byte[] fixedAbq = (byte[])fixedAbqSet.get(Integers.valueOf(o));
568569
MapGroup1.fillAlpha(fixedAbq, 0, map1.aAlpha, m * oxalphaxlsq);
569570
MapGroup1.fillAlpha(fixedAbq, oxalphaxlsq, map1.bAlpha, (m - 1) * oxalphaxlsq);
570571
MapGroup1.fillAlpha(fixedAbq, oxalphaxlsq * 2, map1.qAlpha1, (m - 2) * oxalphaxlsq);

0 commit comments

Comments
 (0)