8225695: 32-bit build failures after JDK-8080462 (Update SunPKCS11 provider with PKCS11 v2.40 support)
Reviewed-by: alanb
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c Fri Jun 14 03:50:25 2019 +0200
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c Fri Jun 14 10:02:57 2019 +0200
@@ -51,6 +51,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
+#include "jlong.h"
#include "sun_security_pkcs11_wrapper_PKCS11.h"
@@ -96,8 +97,8 @@
Java_sun_security_pkcs11_wrapper_PKCS11_freeMechanism
(JNIEnv *env, jclass thisClass, jlong ckpMechanism) {
if (ckpMechanism != 0L) {
- freeCKMechanismPtr((CK_MECHANISM_PTR) ckpMechanism);
- TRACE1("DEBUG PKCS11_freeMechanism: free pMech = %x\n", (jlong)ckpMechanism);
+ freeCKMechanismPtr(jlong_to_ptr(ckpMechanism));
+ TRACE1("DEBUG PKCS11_freeMechanism: free pMech = %x\n", ckpMechanism);
}
return 0L;
}
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c Fri Jun 14 03:50:25 2019 +0200
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c Fri Jun 14 10:02:57 2019 +0200
@@ -91,8 +91,8 @@
(ckpMechanism->pParameter == NULL)) {
freeCKMechanismPtr(ckpMechanism);
} else {
- (*env)->SetLongField(env, jMechanism, mech_pHandleID, (jlong)ckpMechanism);
- TRACE1("DEBUG C_SignInit: stored pMech = 0x%lX\n", (jlong)ckpMechanism);
+ (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism));
+ TRACE1("DEBUG C_SignInit: stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism));
}
TRACE0("FINISHED\n");
}
@@ -303,8 +303,8 @@
(ckpMechanism->pParameter == NULL)) {
freeCKMechanismPtr(ckpMechanism);
} else {
- (*env)->SetLongField(env, jMechanism, mech_pHandleID, (jlong)ckpMechanism);
- TRACE1("DEBUG C_SignRecoverInit, stored pMech = 0x%lX\n", (jlong)ckpMechanism);
+ (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism));
+ TRACE1("DEBUG C_SignRecoverInit, stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism));
}
TRACE0("FINISHED\n");
}
@@ -413,8 +413,8 @@
(ckpMechanism->pParameter == NULL)) {
freeCKMechanismPtr(ckpMechanism);
} else {
- (*env)->SetLongField(env, jMechanism, mech_pHandleID, (jlong)ckpMechanism);
- TRACE1("DEBUG C_VerifyInit: stored pMech = 0x%lX\n", (jlong)ckpMechanism);
+ (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism));
+ TRACE1("DEBUG C_VerifyInit: stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism));
}
TRACE0("FINISHED\n");
}
@@ -601,8 +601,8 @@
(ckpMechanism->pParameter == NULL)) {
freeCKMechanismPtr(ckpMechanism);
} else {
- (*env)->SetLongField(env, jMechanism, mech_pHandleID, (jlong)ckpMechanism);
- TRACE1("DEBUG C_VerifyRecoverInit: stored pMech = 0x%lX\n", (jlong)ckpMechanism);
+ (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism));
+ TRACE1("DEBUG C_VerifyRecoverInit: stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism));
}
TRACE0("FINISHED\n");
}