Skip to content

Commit

Permalink
add debug
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengchenyu committed Aug 6, 2024
1 parent 10b41b7 commit 33cadea
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ static void loadSm4Ctr(JNIEnv *env)
{
#ifdef UNIX
#if OPENSSL_VERSION_NUMBER >= 0x10101001L
printf("loadSm4Ctr DEBUG1: dlsym_EVP_sm4_ctr is %d\n", (dlsym_EVP_sm4_ctr == null));
LOAD_DYNAMIC_SYMBOL(dlsym_EVP_sm4_ctr, env, openssl, "EVP_sm4_ctr");
printf("loadSm4Ctr DEBUG2: dlsym_EVP_sm4_ctr is %d\n", (dlsym_EVP_sm4_ctr == null));
#endif
#endif
}
Expand Down Expand Up @@ -271,12 +273,18 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_crypto_OpensslCipher_initContext
if (alg == SM4_CTR) {
int ret = 0;
#if OPENSSL_VERSION_NUMBER >= 0x10101001L
printf("initContext DEBUG1: OPENSSL_VERSION_NUMBER=%lX\n", OPENSSL_VERSION_NUMBER);
if (dlsym_EVP_sm4_ctr == NULL) {
printf("initContext DEBUG2: dlsym_EVP_sm4_ctr is null\n");
ret = 1;
} else {
printf("initContext DEBUG3: dlsym_EVP_sm4_ctr is not null\n");
}
#else
printf("initContext DEBUG4: OPENSSL_VERSION_NUMBER=%lX\n", OPENSSL_VERSION_NUMBER);
ret = 1;
#endif
printf("initContext DEBUG5: OPENSSL_VERSION_NUMBER=%lX\n", OPENSSL_VERSION_NUMBER);
if (ret) {
THROW(env, "java/security/NoSuchAlgorithmException", \
"Doesn't support SM4 CTR.");
Expand Down

0 comments on commit 33cadea

Please sign in to comment.