Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions make/data/cacerts/entrustevca

This file was deleted.

2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/lang/StringLatin1.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2025, 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
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/lang/invoke/VarHandles.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2025, 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
Expand Down Expand Up @@ -201,7 +201,7 @@ static VarHandle makeArrayElementHandle(Class<?> arrayClass) {

Class<?> componentType = arrayClass.getComponentType();

int aoffset = UNSAFE.arrayBaseOffset(arrayClass);
int aoffset = (int) UNSAFE.arrayBaseOffset(arrayClass);
int ascale = UNSAFE.arrayIndexScale(arrayClass);
int ashift = 31 - Integer.numberOfLeadingZeros(ascale);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6363,7 +6363,7 @@ public final void compute() {
= U.objectFieldOffset(ConcurrentHashMap.class, "cellsBusy");
private static final long CELLVALUE
= U.objectFieldOffset(CounterCell.class, "value");
private static final int ABASE = U.arrayBaseOffset(Node[].class);
private static final long ABASE = U.arrayBaseOffset(Node[].class);
private static final int ASHIFT;

static {
Expand Down
12 changes: 6 additions & 6 deletions src/java.base/share/classes/java/util/zip/CRC32C.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2025, 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
Expand Down Expand Up @@ -219,9 +219,9 @@ private static int updateBytes(int crc, byte[] b, int off, int end) {
if (end - off >= 8 && Unsafe.ARRAY_BYTE_INDEX_SCALE == 1) {

// align on 8 bytes
int alignLength
long alignLength
= (8 - ((Unsafe.ARRAY_BYTE_BASE_OFFSET + off) & 0x7)) & 0x7;
for (int alignEnd = off + alignLength; off < alignEnd; off++) {
for (long alignEnd = off + alignLength; off < alignEnd; off++) {
crc = (crc >>> 8) ^ byteTable[(crc ^ b[off]) & 0xFF];
}

Expand All @@ -235,11 +235,11 @@ private static int updateBytes(int crc, byte[] b, int off, int end) {
int secondHalf;
if (Unsafe.ADDRESS_SIZE == 4) {
// On 32 bit platforms read two ints instead of a single 64bit long
firstHalf = UNSAFE.getInt(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
secondHalf = UNSAFE.getInt(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off
firstHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
secondHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off
+ Integer.BYTES);
} else {
long value = UNSAFE.getLong(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
long value = UNSAFE.getLong(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
firstHalf = (int) value;
secondHalf = (int) (value >>> 32);
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/util/zip/ZipUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2025, 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
Expand Down
36 changes: 23 additions & 13 deletions src/java.base/share/classes/jdk/internal/misc/Unsafe.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, 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
Expand Down Expand Up @@ -1037,8 +1037,11 @@ private void checkWritebackEnabled() {
* This constant differs from all results that will ever be returned from
* {@link #staticFieldOffset}, {@link #objectFieldOffset},
* or {@link #arrayBaseOffset}.
* <p>
* The static type is @code long} to emphasize that long arithmetic should
* always be used for offset calculations to avoid overflows.
*/
public static final int INVALID_FIELD_OFFSET = -1;
public static final long INVALID_FIELD_OFFSET = -1;

/**
* Reports the location of a given field in the storage allocation of its
Expand Down Expand Up @@ -1161,11 +1164,15 @@ public void ensureClassInitialized(Class<?> c) {
* for the same class, you may use that scale factor, together with this
* base offset, to form new offsets to access elements of arrays of the
* given class.
* <p>
* The return value is in the range of a {@code int}. The return type is
* {@code long} to emphasize that long arithmetic should always be used
* for offset calculations to avoid overflows.
*
* @see #getInt(Object, long)
* @see #putInt(Object, long, int)
*/
public int arrayBaseOffset(Class<?> arrayClass) {
public long arrayBaseOffset(Class<?> arrayClass) {
if (arrayClass == null) {
throw new NullPointerException();
}
Expand All @@ -1175,39 +1182,39 @@ public int arrayBaseOffset(Class<?> arrayClass) {


/** The value of {@code arrayBaseOffset(boolean[].class)} */
public static final int ARRAY_BOOLEAN_BASE_OFFSET
public static final long ARRAY_BOOLEAN_BASE_OFFSET
= theUnsafe.arrayBaseOffset(boolean[].class);

/** The value of {@code arrayBaseOffset(byte[].class)} */
public static final int ARRAY_BYTE_BASE_OFFSET
public static final long ARRAY_BYTE_BASE_OFFSET
= theUnsafe.arrayBaseOffset(byte[].class);

/** The value of {@code arrayBaseOffset(short[].class)} */
public static final int ARRAY_SHORT_BASE_OFFSET
public static final long ARRAY_SHORT_BASE_OFFSET
= theUnsafe.arrayBaseOffset(short[].class);

/** The value of {@code arrayBaseOffset(char[].class)} */
public static final int ARRAY_CHAR_BASE_OFFSET
public static final long ARRAY_CHAR_BASE_OFFSET
= theUnsafe.arrayBaseOffset(char[].class);

/** The value of {@code arrayBaseOffset(int[].class)} */
public static final int ARRAY_INT_BASE_OFFSET
public static final long ARRAY_INT_BASE_OFFSET
= theUnsafe.arrayBaseOffset(int[].class);

/** The value of {@code arrayBaseOffset(long[].class)} */
public static final int ARRAY_LONG_BASE_OFFSET
public static final long ARRAY_LONG_BASE_OFFSET
= theUnsafe.arrayBaseOffset(long[].class);

/** The value of {@code arrayBaseOffset(float[].class)} */
public static final int ARRAY_FLOAT_BASE_OFFSET
public static final long ARRAY_FLOAT_BASE_OFFSET
= theUnsafe.arrayBaseOffset(float[].class);

/** The value of {@code arrayBaseOffset(double[].class)} */
public static final int ARRAY_DOUBLE_BASE_OFFSET
public static final long ARRAY_DOUBLE_BASE_OFFSET
= theUnsafe.arrayBaseOffset(double[].class);

/** The value of {@code arrayBaseOffset(Object[].class)} */
public static final int ARRAY_OBJECT_BASE_OFFSET
public static final long ARRAY_OBJECT_BASE_OFFSET
= theUnsafe.arrayBaseOffset(Object[].class);

/**
Expand All @@ -1216,6 +1223,9 @@ public int arrayBaseOffset(Class<?> arrayClass) {
* will generally not work properly with accessors like {@link
* #getByte(Object, long)}, so the scale factor for such classes is reported
* as zero.
* <p>
* The computation of the actual memory offset should always use {@code
* long} arithmetic to avoid overflows.
*
* @see #arrayBaseOffset
* @see #getInt(Object, long)
Expand Down Expand Up @@ -3823,7 +3833,7 @@ private void putShortParts(Object o, long offset, byte i0, byte i1) {
private native Object staticFieldBase0(Field f);
private native boolean shouldBeInitialized0(Class<?> c);
private native void ensureClassInitialized0(Class<?> c);
private native int arrayBaseOffset0(Class<?> arrayClass);
private native int arrayBaseOffset0(Class<?> arrayClass); // public version returns long to promote correct arithmetic
private native int arrayIndexScale0(Class<?> arrayClass);
private native int getLoadAverage0(double[] loadavg, int nelems);
// SapMachine 2025-02-05: Report error for DirectMemoryOom to exit the VM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ public static int mismatch(boolean[] a, int aFromIndex,
if (length > 7) {
if (a[aFromIndex] != b[bFromIndex])
return 0;
int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
long aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
long bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
i = vectorizedMismatch(
a, aOffset,
b, bOffset,
Expand Down Expand Up @@ -285,8 +285,8 @@ public static int mismatch(byte[] a, int aFromIndex,
if (length > 7) {
if (a[aFromIndex] != b[bFromIndex])
return 0;
int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
long aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
long bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
i = vectorizedMismatch(
a, aOffset,
b, bOffset,
Expand Down
49 changes: 41 additions & 8 deletions src/java.base/share/classes/sun/security/pkcs/PKCS7.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2025, 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
Expand Down Expand Up @@ -551,8 +551,23 @@ public void encodeSignedData(DerOutputStream out)
* @exception SignatureException on signature handling errors.
*/
public SignerInfo verify(SignerInfo info, byte[] bytes)
throws NoSuchAlgorithmException, SignatureException {
return info.verify(this, bytes);
throws NoSuchAlgorithmException, SignatureException {
return info.verify(this, bytes, null);
}

/**
* This verifies a given SignerInfo.
*
* @param info the signer information.
* @param bytes the DER encoded content information.
* @param cert certificate used to verify; find one inside the block if null
*
* @exception NoSuchAlgorithmException on unrecognized algorithms.
* @exception SignatureException on signature handling errors.
*/
public SignerInfo verify(SignerInfo info, byte[] bytes, X509Certificate cert)
throws NoSuchAlgorithmException, SignatureException {
return info.verify(this, bytes, cert);
}

/**
Expand Down Expand Up @@ -750,6 +765,19 @@ public boolean isOldStyle() {
return this.oldStyle;
}

// Generate signed data without a specified digAlgID.
public static byte[] generateNewSignedData(
String sigalg, Provider sigProvider,
PrivateKey privateKey, X509Certificate[] signerChain,
byte[] content, boolean internalsf, boolean directsign,
Function<byte[], PKCS9Attributes> ts)
throws SignatureException, InvalidKeyException, IOException,
NoSuchAlgorithmException {
return generateSignedData(sigalg, sigProvider, privateKey, signerChain,
content, internalsf, directsign,
null, ts);
}

/**
* Generate a PKCS7 data block.
*
Expand All @@ -760,34 +788,39 @@ public boolean isOldStyle() {
* @param content the content to sign
* @param internalsf whether the content should be include in output
* @param directsign if the content is signed directly or thru authattrs
* @param digAlgID digest alg to use; derive from other arguments if null
* @param ts (optional) timestamper
* @return the pkcs7 output in an array
* @throws SignatureException if signing failed
* @throws InvalidKeyException if key cannot be used
* @throws IOException should not happen here, all byte array
* @throws NoSuchAlgorithmException if siglag is bad
*/
public static byte[] generateNewSignedData(
public static byte[] generateSignedData(
String sigalg, Provider sigProvider,
PrivateKey privateKey, X509Certificate[] signerChain,
byte[] content, boolean internalsf, boolean directsign,
AlgorithmId digAlgID,
Function<byte[], PKCS9Attributes> ts)
throws SignatureException, InvalidKeyException, IOException,
NoSuchAlgorithmException {

Signature signer = SignatureUtil.fromKey(sigalg, privateKey, sigProvider);

AlgorithmId digAlgID = SignatureUtil.getDigestAlgInPkcs7SignerInfo(
signer, sigalg, privateKey, directsign);
if (digAlgID == null) {
digAlgID = SignatureUtil.getDigestAlgInPkcs7SignerInfo(
signer, sigalg, privateKey, directsign);
}
AlgorithmId sigAlgID = SignatureUtil.fromSignature(signer, privateKey);

PKCS9Attributes authAttrs = null;
if (!directsign) {
// MessageDigest
byte[] md;
String digAlgName = digAlgID.getName();
if (digAlgName.equals("SHAKE256") || digAlgName.equals("SHAKE256-LEN")) {
// No MessageDigest impl for SHAKE256 yet
if (digAlgName.equals("SHAKE256-LEN")) {
// We don't check the LEN here. Usually it is returned
// by SignatureUtil.getDigestAlgInPkcs7SignerInfo
var shaker = new SHAKE256(64);
shaker.update(content, 0, content.length);
md = shaker.digest();
Expand Down
Loading
Loading