8286389: Address possibly lossy conversions in jdk.crypto.ec
Reviewed-by: chegar, xuelei
This commit is contained in:
parent
53b37fe153
commit
e93be3acdf
src/jdk.crypto.ec/share/classes/sun/security/ec
@ -76,7 +76,7 @@ public final class XDHPublicKeyImpl extends X509Key implements XECPublicKey {
|
||||
// clear the extra bits
|
||||
int bitsMod8 = params.getBits() % 8;
|
||||
if (bitsMod8 != 0) {
|
||||
int mask = (1 << bitsMod8) - 1;
|
||||
byte mask = (byte) ((1 << bitsMod8) - 1);
|
||||
u_arr[0] &= mask;
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ public class EdDSAOperations {
|
||||
|
||||
// set the highest bit
|
||||
if (highBits == 0) {
|
||||
k[lastByteIndex - 1] |= 0x80;
|
||||
k[lastByteIndex - 1] |= (byte) 0x80;
|
||||
} else {
|
||||
byte msbMaskOn = (byte) (1 << (highBits - 1));
|
||||
k[lastByteIndex] |= msbMaskOn;
|
||||
@ -278,7 +278,7 @@ public class EdDSAOperations {
|
||||
private static byte[] encode(int length, AffinePoint p) {
|
||||
byte[] result = p.getY().asByteArray(length);
|
||||
int xLSB = p.getX().asByteArray(1)[0] & 0x01;
|
||||
result[result.length - 1] |= (xLSB << 7);
|
||||
result[result.length - 1] |= (byte) (xLSB << 7);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user