Compare commits

...

11 Commits

Author SHA1 Message Date
Valerie Peng
29ce3ae34b 8277227: Better identification of OIDs
Reviewed-by: coffeys
Backport-of: 3ac5f0175356fad40b59f879322fa7d89dfbcaab
2022-01-11 21:36:03 +00:00
Weijun Wang
bab7d80317 8274221: More definite BER encodings
Backport-of: ee39b0fc22a55a051b8a4d5754c34105fe4b734e
2022-01-11 20:34:46 +00:00
robm
d0e26d3e7c Merge 2022-01-11 14:37:37 +00:00
robm
f357fdefad Merge 2022-01-11 13:35:05 +00:00
Weijun Wang
6caa851218 8277233: Improve ECDSA signature support
Backport-of: 34714d63f1be267c2bc2ae7a55f936deab8ea6d2
2022-01-10 21:08:58 +00:00
robm
cbcb39119d Merge 2022-01-10 17:23:39 +00:00
Harold Seigel
a2d1450011 8278384: Bytecodes::result_type() for arraylength returns T_VOID instead of T_INT
Backport-of: 769f14db84
2022-01-10 13:30:53 +00:00
robm
b260c5c939 Merge 2022-01-10 12:47:06 +00:00
robm
419f9ccd83 Merge 2022-01-10 10:23:45 +00:00
Tobias Hartmann
d2ee0647a5 8278798: Improve supported intrinsic
Reviewed-by: chagedorn
Backport-of: 7ed3d37203da74f3f2cc92d06250f74aa5ceccd1
2022-01-07 13:48:08 +00:00
Pavel Kharskii
6d45bba88a 8278869: Bump version numbers for OPENJDK 18.0.1
Reviewed-by: coffeys
2021-12-23 21:12:29 +00:00
8 changed files with 30 additions and 22 deletions

View File

@@ -28,12 +28,12 @@
DEFAULT_VERSION_FEATURE=18
DEFAULT_VERSION_INTERIM=0
DEFAULT_VERSION_UPDATE=0
DEFAULT_VERSION_UPDATE=1
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_EXTRA1=0
DEFAULT_VERSION_EXTRA2=0
DEFAULT_VERSION_EXTRA3=0
DEFAULT_VERSION_DATE=2022-03-22
DEFAULT_VERSION_DATE=2022-04-19
DEFAULT_VERSION_CLASSFILE_MAJOR=62 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_VERSION_DOCS_API_SINCE=11

View File

@@ -1029,7 +1029,6 @@ int ExceptionMessageBuilder::do_instruction(int bci) {
break;
case Bytecodes::_arraylength:
// The return type of arraylength is wrong in the bytecodes table (T_VOID).
stack->pop(1);
stack->push(bci, T_INT);
break;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -471,7 +471,7 @@ void Bytecodes::initialize() {
def(_new , "new" , "bkk" , NULL , T_OBJECT , 1, true );
def(_newarray , "newarray" , "bc" , NULL , T_OBJECT , 0, true );
def(_anewarray , "anewarray" , "bkk" , NULL , T_OBJECT , 0, true );
def(_arraylength , "arraylength" , "b" , NULL , T_VOID , 0, true );
def(_arraylength , "arraylength" , "b" , NULL , T_INT , 0, true );
def(_athrow , "athrow" , "b" , NULL , T_VOID , -1, true );
def(_checkcast , "checkcast" , "bkk" , NULL , T_OBJECT , 0, true );
def(_instanceof , "instanceof" , "bkk" , NULL , T_INT , 0, true );

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1580,7 +1580,7 @@ bool LibraryCallKit::inline_string_char_access(bool is_store) {
if (is_store) {
access_store_at(value, adr, TypeAryPtr::BYTES, ch, TypeInt::CHAR, T_CHAR, IN_HEAP | MO_UNORDERED | C2_MISMATCHED);
} else {
ch = access_load_at(value, adr, TypeAryPtr::BYTES, TypeInt::CHAR, T_CHAR, IN_HEAP | MO_UNORDERED | C2_MISMATCHED | C2_CONTROL_DEPENDENT_LOAD);
ch = access_load_at(value, adr, TypeAryPtr::BYTES, TypeInt::CHAR, T_CHAR, IN_HEAP | MO_UNORDERED | C2_MISMATCHED | C2_CONTROL_DEPENDENT_LOAD | C2_UNKNOWN_CONTROL_LOAD);
set_result(ch);
}
return true;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -362,7 +362,8 @@ abstract class DSA extends SignatureSpi {
s = new BigInteger(1, s.toByteArray());
}
if ((r.compareTo(presetQ) == -1) && (s.compareTo(presetQ) == -1)) {
if ((r.compareTo(presetQ) == -1) && (s.compareTo(presetQ) == -1)
&& r.signum() > 0 && s.signum() > 0) {
BigInteger w = generateW(presetP, presetQ, presetG, s);
BigInteger v = generateV(presetY, presetP, presetQ, presetG, w, r);
return v.equals(r);

View File

@@ -144,15 +144,14 @@ class DerIndefLenConverter {
* then skip the tag and its 1 byte length of zero.
*/
private void writeTag() {
if (dataPos == dataSize) {
return;
}
assert dataPos + 1 < dataSize;
if (isEOC(data, dataPos)) {
dataPos += 2; // skip tag and length
writeTag();
} else {
newData[newDataPos++] = data[dataPos++];
while (dataPos < dataSize) {
assert dataPos + 1 < dataSize;
if (isEOC(data, dataPos)) {
dataPos += 2; // skip tag and length
} else {
newData[newDataPos++] = data[dataPos++];
break;
}
}
}

View File

@@ -365,7 +365,7 @@ public final class ObjectIdentifier implements Serializable {
if ((encoding[i] & 0x80) == 0) {
// one section [fromPos..i]
if (i - fromPos + 1 > 4) {
BigInteger big = new BigInteger(pack(encoding,
BigInteger big = new BigInteger(1, pack(encoding,
fromPos, i-fromPos+1, 7, 8));
if (fromPos == 0) {
result[which++] = 2;
@@ -434,7 +434,7 @@ public final class ObjectIdentifier implements Serializable {
sb.append('.');
}
if (i - fromPos + 1 > 4) { // maybe big integer
BigInteger big = new BigInteger(
BigInteger big = new BigInteger(1,
pack(encoding, fromPos, i-fromPos+1, 7, 8));
if (fromPos == 0) {
// first section encoded with more than 4 bytes,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@ import sun.security.util.ArrayUtil;
import sun.security.util.math.*;
import static sun.security.ec.ECOperations.IntermediateValueException;
import java.math.BigInteger;
import java.security.ProviderException;
import java.security.spec.*;
import java.util.Arrays;
@@ -200,7 +201,8 @@ public class ECDSAOperations {
IntegerFieldModuloP field = ecOps.getField();
IntegerFieldModuloP orderField = ecOps.getOrderField();
int length = (orderField.getSize().bitLength() + 7) / 8;
BigInteger mod = orderField.getSize();
int length = (mod.bitLength() + 7) / 8;
byte[] r;
byte[] s;
@@ -218,6 +220,13 @@ public class ECDSAOperations {
System.arraycopy(sig, encodeLength, s, length - encodeLength, encodeLength);
}
BigInteger rb = new BigInteger(1, r);
BigInteger sb = new BigInteger(1, s);
if (rb.signum() == 0 || sb.signum() == 0
|| rb.compareTo(mod) >= 0 || sb.compareTo(mod) >= 0) {
return false;
}
ArrayUtil.reverse(r);
ArrayUtil.reverse(s);
IntegerModuloP ri = orderField.getElement(r);