Skip to content

Commit

Permalink
compatibility updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Aug 16, 2017
1 parent 970f853 commit 66cfbcc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.bouncycastle.crypto.engines;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;

import org.bouncycastle.crypto.BlockCipher;
import org.bouncycastle.crypto.CipherParameters;
Expand Down Expand Up @@ -373,9 +373,9 @@ public static byte[] getSBox(

public static String getSBoxName(byte[] sBox)
{
for (Iterator it = sBoxes.keySet().iterator(); it.hasNext();)
for (Enumeration en = sBoxes.keys(); en.hasMoreElements();)
{
String name = (String)it.next();
String name = (String)en.nextElement();
byte[] sb = (byte[])sBoxes.get(name);
if (Arrays.areEqual(sb, sBox))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
public class KGCMBlockCipher
implements AEADBlockCipher
{
private static final BigInteger ZERO = BigInteger.valueOf(0);
private static final BigInteger ONE = BigInteger.valueOf(1);

/* Constants for GF(2^m) operations */
private static final BigInteger MASK_1_128 = new BigInteger("340282366920938463463374607431768211456", 10);
Expand Down Expand Up @@ -414,20 +416,20 @@ private void multiplyOverField(int blockBitLength, byte[] x, byte[] y, byte[] x_
break;
}

BigInteger p = BigInteger.ZERO;
BigInteger p = ZERO;
BigInteger p1 = new BigInteger(1, fieldOperationBuffer1);
BigInteger p2 = new BigInteger(1, fieldOperationBuffer2);

while (!p2.equals(BigInteger.ZERO))
while (!p2.equals(ZERO))
{
if (p2.and(BigInteger.ONE).equals(BigInteger.ONE))
if (p2.and(ONE).equals(ONE))
{
p = p.xor(p1);
}

p1 = p1.shiftLeft(1);

if (!p1.and(mask1).equals(BigInteger.ZERO))
if (!p1.and(mask1).equals(ZERO))
{
p1 = p1.xor(polyred);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class DSTU7624Test

private static byte[] randomBytes(int min, int max)
{
int count = min + RANDOM.nextInt(max - min);
int count = min + RNGUtils.nextInt(RANDOM,max - min);
byte[] result = new byte[count];
RANDOM.nextBytes(result);
return result;
Expand Down

0 comments on commit 66cfbcc

Please sign in to comment.