1 Star 0 Fork 66

Dingli Zhang/openjdk-11

forked from src-openEuler/openjdk-11 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fix_Internal_and_external_code_inconsistency.patch 7.31 KB
一键复制 编辑 原始数据 按行查看 历史
kuen 提交于 2022-07-26 20:58 . I5J14Z: upgrade to jdk11.0.16-ga
diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp
index 7b891d55..0440d4cb 100644
--- a/src/hotspot/share/opto/graphKit.cpp
+++ b/src/hotspot/share/opto/graphKit.cpp
@@ -46,7 +46,6 @@
#include "runtime/sharedRuntime.hpp"
#include "utilities/bitMap.inline.hpp"
#include "utilities/macros.hpp"
-#include "utilities/bitMap.inline.hpp"
#if INCLUDE_SHENANDOAHGC
#include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp"
#endif
diff --git a/src/java.base/unix/native/libjava/path_util.c b/src/java.base/unix/native/libjava/path_util.c
index 8a533f81..4b978206 100644
--- a/src/java.base/unix/native/libjava/path_util.c
+++ b/src/java.base/unix/native/libjava/path_util.c
@@ -116,7 +116,6 @@ collapse(char *path)
int nc;
char **ix;
int i, j;
- char *p, *q;
nc = collapsible(names);
if (nc < 2) return; /* Nothing to do */
diff --git a/src/jdk.crypto.kaeprovider/linux/classes/org/openeuler/security/openssl/KAEDHKeyPairGenerator.java b/src/jdk.crypto.kaeprovider/linux/classes/org/openeuler/security/openssl/KAEDHKeyPairGenerator.java
index 429c65fc..6094c82a 100644
--- a/src/jdk.crypto.kaeprovider/linux/classes/org/openeuler/security/openssl/KAEDHKeyPairGenerator.java
+++ b/src/jdk.crypto.kaeprovider/linux/classes/org/openeuler/security/openssl/KAEDHKeyPairGenerator.java
@@ -148,6 +148,9 @@ public class KAEDHKeyPairGenerator
throw new ProviderException("Invoke nativeGenerateKeyPair failed.", e);
}
+ // check keys
+ checkKeys(keys);
+
BigInteger pubKey = new BigInteger(keys[0]);
BigInteger priKey = new BigInteger(keys[1]);
@@ -162,5 +165,21 @@ public class KAEDHKeyPairGenerator
throw new ProviderException(ikse);
}
}
+
+ private void checkKeys(byte[][] keys) {
+ if (keys == null) {
+ throw new ProviderException("Invalid keys, keys is null.");
+ }
+ // The keys needs to contain at least 2 byte arrays, which are public and private keys.
+ if (keys.length < 2) {
+ throw new ProviderException("Invalid keys, keys length is less than 2.");
+ }
+ for (int i = 0; i < keys.length; i++) {
+ if (keys[i] == null) {
+ throw new ProviderException("Invalid keys, keys[" + i + "]" + "is null.");
+ }
+ }
+ }
+
protected native static byte[][] nativeGenerateKeyPair(byte[] p, byte[] g, int lSize);
}
diff --git a/src/jdk.crypto.kaeprovider/linux/classes/org/openeuler/security/openssl/KAEECKeyPairGenerator.java b/src/jdk.crypto.kaeprovider/linux/classes/org/openeuler/security/openssl/KAEECKeyPairGenerator.java
index 60fa8183..f563f948 100644
--- a/src/jdk.crypto.kaeprovider/linux/classes/org/openeuler/security/openssl/KAEECKeyPairGenerator.java
+++ b/src/jdk.crypto.kaeprovider/linux/classes/org/openeuler/security/openssl/KAEECKeyPairGenerator.java
@@ -68,9 +68,8 @@ public class KAEECKeyPairGenerator extends KeyPairGeneratorSpi {
private ECParameterSpec getParamsByCurve(String curveName) {
byte[][] params = nativeGenerateParam(curveName);
- if (params == null) {
- throw new InvalidParameterException("unknown curve " + curveName);
- }
+ // check params
+ checkParams(params, curveName);
BigInteger p = new BigInteger(params[0]);
BigInteger a = new BigInteger(params[1]);
BigInteger b = new BigInteger(params[2]);
@@ -85,6 +84,21 @@ public class KAEECKeyPairGenerator extends KeyPairGeneratorSpi {
return spec;
}
+ private void checkParams(byte[][] params, String curveName) {
+ if (params == null) {
+ throw new InvalidParameterException("Unknown curve " + curveName);
+ }
+ // The params needs to contain at least 7 byte arrays, which are public and private keys
+ if (params.length < 7) {
+ throw new InvalidParameterException("The params length is less than 7.");
+ }
+ for (int i = 0; i < params.length; i++) {
+ if (params[i] == null) {
+ throw new InvalidParameterException("The params[" + i + "]" + "is null.");
+ }
+ }
+ }
+
@Override
public void initialize(AlgorithmParameterSpec param, SecureRandom random) throws InvalidAlgorithmParameterException {
if (param instanceof ECParameterSpec) {
diff --git a/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_exception.c b/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_exception.c
index f684f6ee..56acbfd7 100644
--- a/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_exception.c
+++ b/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_exception.c
@@ -105,14 +105,10 @@ void KAE_ThrowFromOpenssl(JNIEnv* env, const char* msg, void (* defaultException
KAE_TRACE("OpenSSL error in %s: err=%lx, lib=%x, reason=%x, file=%s, line=%d, estring=%s, data=%s", msg, err,
lib, reason, file, line, estring, (flags & ERR_TXT_STRING) ? data : "(no data)");
- switch (lib) {
- case ERR_LIB_EVP:
- case ERR_LIB_RSA:
- KAE_ThrowEvpException(env, reason, estring, defaultException);
- break;
- default:
- defaultException(env, estring);
- break;
+ if (lib == ERR_LIB_EVP || lib == ERR_LIB_RSA) {
+ KAE_ThrowEvpException(env, reason, estring, defaultException);
+ } else {
+ defaultException(env, estring);
}
}
diff --git a/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_hmac.c b/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_hmac.c
index 7b28fa1f..554a9750 100644
--- a/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_hmac.c
+++ b/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_hmac.c
@@ -182,7 +182,7 @@ JNIEXPORT jint JNICALL Java_org_openeuler_security_openssl_KAEHMac_nativeFinal
// write back to output_array
(*env)->SetByteArrayRegion(env, output, out_offset, bytesWritten, (jbyte*) temp_result);
- KAE_TRACE("KAEHMac_nativeFinal success, output_offset = %d, bytesWritten = %d", out_offset, bytesWritten);
+ KAE_TRACE("KAEHMac_nativeFinal success, output_offset = %d, bytesWritten = %u", out_offset, bytesWritten);
cleanup:
free(temp_result);
diff --git a/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_keypairgenerator_rsa.c b/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_keypairgenerator_rsa.c
index d4c9d6ac..6785f543 100644
--- a/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_keypairgenerator_rsa.c
+++ b/src/jdk.crypto.kaeprovider/linux/native/libj2kae/org/openeuler/security/openssl/kae_keypairgenerator_rsa.c
@@ -133,7 +133,8 @@ static jobjectArray NewRSAKeyParams(JNIEnv* env, RSA* rsa) {
}
// set rsa key param
- for (RSAParamIndex paramIndex = rsaN; paramIndex <= rsaIqmp; paramIndex++) {
+ RSAParamIndex paramIndex;
+ for (paramIndex = rsaN; paramIndex <= rsaIqmp; paramIndex++) {
if (!SetRSAKeyParam(env, rsa, params, paramIndex)) {
return NULL;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/DingliZhang/openjdk-11.git
git@gitee.com:DingliZhang/openjdk-11.git
DingliZhang
openjdk-11
openjdk-11
master

搜索帮助