F-11877: check key initialization results in WolfCrypt verify/decrypt helpers
parent
0742792d48
commit
14673f945c
|
|
@ -70,7 +70,11 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfCryptECC_doVerify
|
|||
return -1;
|
||||
}
|
||||
|
||||
wc_ecc_init(&myKey);
|
||||
ret = wc_ecc_init(&myKey);
|
||||
if (ret != 0) {
|
||||
printf("wc_ecc_init failed, ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = wc_ecc_import_x963(keyBuf, (unsigned int)keySz, &myKey);
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,11 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfCryptRSA_doVerify
|
|||
return -1;
|
||||
}
|
||||
|
||||
wc_InitRsaKey(&myKey, NULL);
|
||||
ret = wc_InitRsaKey(&myKey, NULL);
|
||||
if (ret != 0) {
|
||||
printf("wc_InitRsaKey failed, ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
idx = 0;
|
||||
|
||||
ret = wc_RsaPublicKeyDecode(keyBuf, &idx, &myKey, (unsigned int)keySz);
|
||||
|
|
@ -533,7 +537,11 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfCryptRSA_doDec
|
|||
return -1;
|
||||
}
|
||||
|
||||
wc_InitRsaKey(&myKey, NULL);
|
||||
ret = wc_InitRsaKey(&myKey, NULL);
|
||||
if (ret != 0) {
|
||||
printf("wc_InitRsaKey failed, ret = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
idx = 0;
|
||||
|
||||
ret = wc_RsaPrivateKeyDecode(keyBuf, &idx, &myKey, (unsigned int)keySz);
|
||||
|
|
|
|||
Loading…
Reference in New Issue