forked from wolfSSL/wolfssl
Fix for using async with —enable-eccencrypt.
This commit is contained in:
committed by
David Garske
parent
17587d38f8
commit
6cc3983894
@ -7163,8 +7163,13 @@ int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = wc_ecc_shared_secret(privKey, pubKey, sharedSecret, &sharedSz);
|
ret = 0;
|
||||||
|
do {
|
||||||
|
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||||
|
ret = wc_AsyncWait(ret, &privKey->asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
|
||||||
|
#endif
|
||||||
|
ret = wc_ecc_shared_secret(privKey, pubKey, sharedSecret, &sharedSz);
|
||||||
|
} while (ret == WC_PENDING_E);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
switch (ctx->kdfAlgo) {
|
switch (ctx->kdfAlgo) {
|
||||||
case ecHKDF_SHA256 :
|
case ecHKDF_SHA256 :
|
||||||
@ -7193,6 +7198,9 @@ int wc_ecc_encrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
break;
|
break;
|
||||||
ret = wc_AesCbcEncrypt(&aes, out, msg, msgSz);
|
ret = wc_AesCbcEncrypt(&aes, out, msg, msgSz);
|
||||||
|
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||||
|
ret = wc_AsyncWait(ret, &aes.asyncDev, WC_ASYNC_FLAG_NONE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -7316,8 +7324,13 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = wc_ecc_shared_secret(privKey, pubKey, sharedSecret, &sharedSz);
|
ret = 0;
|
||||||
|
do {
|
||||||
|
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||||
|
ret = wc_AsyncWait(ret, &privKey->asyncDev, WC_ASYNC_FLAG_CALL_AGAIN);
|
||||||
|
#endif
|
||||||
|
ret = wc_ecc_shared_secret(privKey, pubKey, sharedSecret, &sharedSz);
|
||||||
|
} while (ret == WC_PENDING_E);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
switch (ctx->kdfAlgo) {
|
switch (ctx->kdfAlgo) {
|
||||||
case ecHKDF_SHA256 :
|
case ecHKDF_SHA256 :
|
||||||
@ -7379,6 +7392,9 @@ int wc_ecc_decrypt(ecc_key* privKey, ecc_key* pubKey, const byte* msg,
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
break;
|
break;
|
||||||
ret = wc_AesCbcDecrypt(&aes, out, msg, msgSz-digestSz);
|
ret = wc_AesCbcDecrypt(&aes, out, msg, msgSz-digestSz);
|
||||||
|
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||||
|
ret = wc_AsyncWait(ret, &aes.asyncDev, WC_ASYNC_FLAG_NONE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user