On 6/13/19 1:14 PM, Alan Bateman wrote: > On 13/06/2019 12:03, Aleksey Shipilev wrote: >> Maybe? That header is from another library/module, though: libjava, and we >> are at libj2pkcs11. I am >> a bit worried about introducing this dependency. It is probably fine to >> #include <jlong_md.h>? > > I see p11_digest.c seems to include jlong.h already, also pkcs11wrapper.h is > including jni_util.h. > This suggests it must be making use of some of the macros but not any of the > functions. I think > there are many opportunities to clean up this code.
Yes. My current problem is that jdk/jdk is broken pre-jdk13 fork. jdk-submit returned clean, and all other tests show the patch is okay. Current macros do what unsafe.cpp does in this situation. We can probably do the thing below, but it does not look much cleaner: diff -r 458d5b2269e9 src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11wrapper.h --- src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11wrapper.h Thu Jun 13 11:37:38 2019 +0200 +++ src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11wrapper.h Thu Jun 13 13:22:29 2019 +0200 @@ -59,4 +59,6 @@ #define _PKCS11WRAPPER_H 1 +#include "jlong.h" + /* disable asserts in product mode */ #ifndef DEBUG @@ -208,6 +210,6 @@ #define unsignedIntToCKULong(x) ((CK_ULONG) x) -#define jLongToCKMechanismPtr(x) ((CK_MECHANISM_PTR)(uintptr_t) x) -#define cKMechanismPtrToJLong(x) ((jlong)(uintptr_t) x) +#define jLongToCKMechanismPtr(x) ((CK_MECHANISM_PTR)jlong_to_ptr(x)) +#define cKMechanismPtrToJLong(x) (ptr_to_jlong(x)) #ifdef P11_DEBUG -Aleksey
signature.asc
Description: OpenPGP digital signature