I3UNZ2: fix kae implementation && add default conf file for kae

This commit is contained in:
kuenking111 2021-06-07 16:31:07 +08:00
parent 790f0d1cbd
commit b1a978197e
3 changed files with 74 additions and 4 deletions

View File

@ -0,0 +1,64 @@
diff --git a/jdk/make/CopyFiles.gmk b/jdk/make/CopyFiles.gmk
index 1f68aaf4c..43e278f7a 100644
--- a/jdk/make/CopyFiles.gmk
+++ b/jdk/make/CopyFiles.gmk
@@ -631,4 +631,16 @@ endif
##########################################################################################
+ifeq ($(OPENJDK_TARGET_CPU_ARCH), aarch64)
+
+ KAE_CONF_PATH= $(JDK_OUTPUTDIR)/lib/ext
+ $(KAE_CONF_PATH)/kaeprovider.conf: $(JDK_TOPDIR)/src/share/lib/security/kaeprovider.conf
+ $(call install-file)
+
+ COPY_FILES += $(KAE_CONF_PATH)/kaeprovider.conf
+
+endif
+
+##########################################################################################
+
-include $(CUSTOM_MAKE_DIR)/CopyFiles.gmk
diff --git a/jdk/src/share/lib/security/kaeprovider.conf b/jdk/src/share/lib/security/kaeprovider.conf
new file mode 100644
index 000000000..a48969669
--- /dev/null
+++ b/jdk/src/share/lib/security/kaeprovider.conf
@@ -0,0 +1,19 @@
+#
+# This is the config file for KAEProvider
+#
+# Algorithms are enabled by default if KAEProvider is used.
+# Delete # if you want to disable certain algorithm.
+
+# kae.md5=false
+# kae.sha256=false
+# kae.sha384=false
+# kae.sm3=false
+# kae.aes=false
+# kae.sm4=false
+# kae.hmac=false
+# kae.rsa=false
+# kae.dh=false
+# kae.ec=false
+
+# enable KAEProvider log setting
+# kae.log=true
diff --git a/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEProvider.java b/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEProvider.java
index 419a8744b..83ed8649c 100644
--- a/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEProvider.java
+++ b/jdk/src/solaris/classes/org/openeuler/security/openssl/KAEProvider.java
@@ -100,11 +100,11 @@ public class KAEProvider extends Provider {
public KAEProvider() {
super("KAEProvider", 1.8d, "KAE provider");
- if (needLog) {
+ Properties props = getProp();
+ if (needLog && "true".equalsIgnoreCase(props.getProperty("kae.log"))) {
logStart(excp);
needLog = false; // Log only once
}
- Properties props = getProp();
if (!"false".equalsIgnoreCase(props.getProperty("kae.md5"))) {
putMD5();
}

View File

@ -1506,7 +1506,7 @@ index 54c5cbdf..ce6b608e 100644
import java.util.concurrent.ConcurrentSkipListSet;
-public abstract class KAEMac extends MacSpi implements Cloneable {
+public abstract class KAEHMac extends MacSpi implements Cloneable {
+public abstract class KAEHMac extends MacSpi {
private final String algorithm;
@ -3748,7 +3748,7 @@ index 00000000..897e2c6b
+ } catch (ArrayIndexOutOfBoundsException | BadPaddingException e) {
+ if (e instanceof AEADBadTagException) {
+ throw e; // AEADBadTagException is expected for some tests
+ } else if (e instanceof BadPaddingException) {
+ } else if (e instanceof BadPaddingException || e.getMessage().contains("wrong final block length")) {
+ if (padding == Padding.NOPADDING) {
+ throw new IllegalBlockSizeException("Input length not multiple of " + blockSize + " bytes");
+ } else {

View File

@ -585,6 +585,7 @@ exit 0
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libnpt.so
%ifarch %{aarch64}
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libj2kae.so
%{_jvmdir}/%{jredir -- %{?1}}/lib/ext/kaeprovider.conf
%endif
%ifarch %{sa_arches}
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libsaproc.so
@ -917,7 +918,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r
Name: java-%{javaver}-%{origin}
Version: %{javaver}.%{updatever}.%{buildver}
Release: 5
Release: 6
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
# also included the epoch in their virtual provides. This created a
@ -1101,6 +1102,7 @@ Patch188: 8247691_incorrect_handling_of_VM_exceptions_in_C1_deopt_stub.patch
Patch189: 8266187_Memory_leak_in_appendBootClassPath.patch
Patch190: 8266929_huawei_add_oid_mapping_common_sig_types.patch
Patch191: 8264640.patch
Patch192: add_kae_implementation_add_default_conf_file.patch
#############################################
#
@ -1552,6 +1554,7 @@ pushd %{top_level_dir_name}
%patch189 -p1
%patch190 -p1
%patch191 -p1
%patch192 -p1
popd
@ -2169,7 +2172,10 @@ require "copy_jdk_configs.lua"
%endif
%changelog
* Fri Sat 4 2021 hedongbo <hedongbo@huawei.com> - 1:1.8.0.292-b10.5
* Mon Jun 27 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.292-b10.6
- add add_kae_implementation_add_default_conf_file.patch
* Fri Jun 4 2021 hedongbo <hedongbo@huawei.com> - 1:1.8.0.292-b10.5
- change the way to get the version in openjdk-1.8.0.spec
* Thu May 27 2021 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.292-b10.4