mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
WOLFSSL_ASYNC_CRYPT: in EccSharedSecret(), don't try to wolfSSL_AsyncInit() if there's no priv_key to supply an asyncDev; in RSA _ifc_pairwise_consistency_test(), disable async to force blocking crypto.
This commit is contained in:
@ -4677,10 +4677,10 @@ int EccSharedSecret(WOLFSSL* ssl, ecc_key* priv_key, ecc_key* pub_key,
|
|||||||
/* initialize event */
|
/* initialize event */
|
||||||
if (priv_key != NULL) {
|
if (priv_key != NULL) {
|
||||||
asyncDev = &priv_key->asyncDev;
|
asyncDev = &priv_key->asyncDev;
|
||||||
|
ret = wolfSSL_AsyncInit(ssl, asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
|
||||||
|
if (ret != 0)
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
ret = wolfSSL_AsyncInit(ssl, asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
|
|
||||||
if (ret != 0)
|
|
||||||
return ret;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_PK_CALLBACKS
|
#ifdef HAVE_PK_CALLBACKS
|
||||||
|
@ -616,6 +616,9 @@ static int _ifc_pairwise_consistency_test(RsaKey* key, WC_RNG* rng)
|
|||||||
byte* plain;
|
byte* plain;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
word32 msgLen, plainLen, sigLen;
|
word32 msgLen, plainLen, sigLen;
|
||||||
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||||
|
word32 saved_async_marker;
|
||||||
|
#endif
|
||||||
|
|
||||||
msgLen = (word32)XSTRLEN(msg);
|
msgLen = (word32)XSTRLEN(msg);
|
||||||
sigLen = wc_RsaEncryptSize(key);
|
sigLen = wc_RsaEncryptSize(key);
|
||||||
@ -628,6 +631,12 @@ static int _ifc_pairwise_consistency_test(RsaKey* key, WC_RNG* rng)
|
|||||||
XMEMSET(sig, 0, sigLen);
|
XMEMSET(sig, 0, sigLen);
|
||||||
plain = sig;
|
plain = sig;
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||||
|
/* force blocking calculations. */
|
||||||
|
saved_async_marker = key->asyncDev.marker;
|
||||||
|
key->asyncDev.marker = WOLFSSL_ASYNC_MARKER_INVALID;
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = wc_RsaSSL_Sign((const byte*)msg, msgLen, sig, sigLen, key, rng);
|
ret = wc_RsaSSL_Sign((const byte*)msg, msgLen, sig, sigLen, key, rng);
|
||||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||||
if (ret == WC_PENDING_E) {
|
if (ret == WC_PENDING_E) {
|
||||||
@ -655,6 +664,10 @@ static int _ifc_pairwise_consistency_test(RsaKey* key, WC_RNG* rng)
|
|||||||
ForceZero(sig, sigLen);
|
ForceZero(sig, sigLen);
|
||||||
XFREE(sig, NULL, DYNAMIC_TYPE_RSA);
|
XFREE(sig, NULL, DYNAMIC_TYPE_RSA);
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||||
|
key->asyncDev.marker = saved_async_marker;
|
||||||
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user