fixes for heap hint used
parent
195369a5f1
commit
f99fc863df
|
@ -3021,7 +3021,7 @@ int NativeEccSharedSecretCb(WOLFSSL* ssl, ecc_key* otherKey,
|
||||||
(*jenv)->DeleteLocalRef(jenv, ctxRef);
|
(*jenv)->DeleteLocalRef(jenv, ctxRef);
|
||||||
(*jenv)->DeleteLocalRef(jenv, eccKeyObject);
|
(*jenv)->DeleteLocalRef(jenv, eccKeyObject);
|
||||||
wc_ecc_free(&tmpKey);
|
wc_ecc_free(&tmpKey);
|
||||||
XFREE(tmpKeyDer, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(tmpKeyDer, otherKey->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
throwWolfSSLJNIExceptionWithMsg(jenv, "Failed to export "
|
throwWolfSSLJNIExceptionWithMsg(jenv, "Failed to export "
|
||||||
"eccSharedSecret public key to DER", needsDetach);
|
"eccSharedSecret public key to DER", needsDetach);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3034,7 +3034,7 @@ int NativeEccSharedSecretCb(WOLFSSL* ssl, ecc_key* otherKey,
|
||||||
if (!pubKeyDerBB) {
|
if (!pubKeyDerBB) {
|
||||||
(*jenv)->DeleteLocalRef(jenv, ctxRef);
|
(*jenv)->DeleteLocalRef(jenv, ctxRef);
|
||||||
(*jenv)->DeleteLocalRef(jenv, eccKeyObject);
|
(*jenv)->DeleteLocalRef(jenv, eccKeyObject);
|
||||||
XFREE(tmpKeyDer, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(tmpKeyDer, otherKey->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
throwWolfSSLJNIExceptionWithMsg(jenv, "Failed to create "
|
throwWolfSSLJNIExceptionWithMsg(jenv, "Failed to create "
|
||||||
"eccSharedSecret publicKeyDer ByteBuffer", needsDetach);
|
"eccSharedSecret publicKeyDer ByteBuffer", needsDetach);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3062,7 +3062,7 @@ int NativeEccSharedSecretCb(WOLFSSL* ssl, ecc_key* otherKey,
|
||||||
(*jenv)->DeleteLocalRef(jenv, eccKeyObject);
|
(*jenv)->DeleteLocalRef(jenv, eccKeyObject);
|
||||||
(*jenv)->DeleteLocalRef(jenv, pubKeyDerBB);
|
(*jenv)->DeleteLocalRef(jenv, pubKeyDerBB);
|
||||||
if (side == WOLFSSL_SERVER_END)
|
if (side == WOLFSSL_SERVER_END)
|
||||||
XFREE(tmpKeyDer, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(tmpKeyDer, otherKey->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
throwWolfSSLJNIExceptionWithMsg(jenv, "Failed to create "
|
throwWolfSSLJNIExceptionWithMsg(jenv, "Failed to create "
|
||||||
"eccSharedSecret array for publicKeyDerSz", needsDetach);
|
"eccSharedSecret array for publicKeyDerSz", needsDetach);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3077,7 +3077,7 @@ int NativeEccSharedSecretCb(WOLFSSL* ssl, ecc_key* otherKey,
|
||||||
(*jenv)->DeleteLocalRef(jenv, pubKeyDerBB);
|
(*jenv)->DeleteLocalRef(jenv, pubKeyDerBB);
|
||||||
(*jenv)->DeleteLocalRef(jenv, j_pubKeyDerSz);
|
(*jenv)->DeleteLocalRef(jenv, j_pubKeyDerSz);
|
||||||
if (side == WOLFSSL_SERVER_END)
|
if (side == WOLFSSL_SERVER_END)
|
||||||
XFREE(tmpKeyDer, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(tmpKeyDer, otherKey->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
throwWolfSSLJNIExceptionWithMsg(jenv, "Failed to create "
|
throwWolfSSLJNIExceptionWithMsg(jenv, "Failed to create "
|
||||||
"eccSharedSecret out ByteBuffer", needsDetach);
|
"eccSharedSecret out ByteBuffer", needsDetach);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3093,7 +3093,7 @@ int NativeEccSharedSecretCb(WOLFSSL* ssl, ecc_key* otherKey,
|
||||||
(*jenv)->DeleteLocalRef(jenv, pubKeyDerBB);
|
(*jenv)->DeleteLocalRef(jenv, pubKeyDerBB);
|
||||||
(*jenv)->DeleteLocalRef(jenv, j_pubKeyDerSz);
|
(*jenv)->DeleteLocalRef(jenv, j_pubKeyDerSz);
|
||||||
if (side == WOLFSSL_SERVER_END)
|
if (side == WOLFSSL_SERVER_END)
|
||||||
XFREE(tmpKeyDer, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(tmpKeyDer, otherKey->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
throwWolfSSLJNIExceptionWithMsg(jenv, "Failed to create "
|
throwWolfSSLJNIExceptionWithMsg(jenv, "Failed to create "
|
||||||
"eccSharedSecret array for outSz", needsDetach);
|
"eccSharedSecret array for outSz", needsDetach);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3110,7 +3110,7 @@ int NativeEccSharedSecretCb(WOLFSSL* ssl, ecc_key* otherKey,
|
||||||
(*jenv)->DeleteLocalRef(jenv, eccKeyObject);
|
(*jenv)->DeleteLocalRef(jenv, eccKeyObject);
|
||||||
(*jenv)->DeleteLocalRef(jenv, pubKeyDerBB);
|
(*jenv)->DeleteLocalRef(jenv, pubKeyDerBB);
|
||||||
if (side == WOLFSSL_SERVER_END) {
|
if (side == WOLFSSL_SERVER_END) {
|
||||||
XFREE(tmpKeyDer, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(tmpKeyDer, otherKey->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval == 0) {
|
if (retval == 0) {
|
||||||
|
|
|
@ -199,7 +199,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_wolfssl_wolfcrypt_EccKey_EccPrivateKeyToPK
|
||||||
|
|
||||||
ret = wc_EccPrivateKeyToPKCS8(key, result, &resultSz);
|
ret = wc_EccPrivateKeyToPKCS8(key, result, &resultSz);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
XFREE(result, (ecc_key*)eccKey->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(result, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
(*jenv)->ThrowNew(jenv, excClass,
|
(*jenv)->ThrowNew(jenv, excClass,
|
||||||
"Native call to wc_EccPrivateKeyToDer failed");
|
"Native call to wc_EccPrivateKeyToDer failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue