Fix for ensuring devId is passed into symmetric init.

This commit is contained in:
David Garske
2019-01-18 14:08:58 -08:00
parent dad88b4c81
commit 7e3082906e

View File

@@ -2931,17 +2931,13 @@ static void CacheStatusPP(SecureRenegotiation* cache)
*/ */
int SetKeysSide(WOLFSSL* ssl, enum encrypt_side side) int SetKeysSide(WOLFSSL* ssl, enum encrypt_side side)
{ {
int devId = INVALID_DEVID, ret, copy = 0; int ret, copy = 0;
Ciphers* wc_encrypt = NULL; Ciphers* wc_encrypt = NULL;
Ciphers* wc_decrypt = NULL; Ciphers* wc_decrypt = NULL;
Keys* keys = &ssl->keys; Keys* keys = &ssl->keys;
(void)copy; (void)copy;
#ifdef WOLFSSL_ASYNC_CRYPT
devId = ssl->devId;
#endif
#ifdef HAVE_SECURE_RENEGOTIATION #ifdef HAVE_SECURE_RENEGOTIATION
if (ssl->secure_renegotiation && ssl->secure_renegotiation->cache_status) { if (ssl->secure_renegotiation && ssl->secure_renegotiation->cache_status) {
keys = &ssl->secure_renegotiation->tmp_keys; keys = &ssl->secure_renegotiation->tmp_keys;
@@ -3003,14 +2999,14 @@ int SetKeysSide(WOLFSSL* ssl, enum encrypt_side side)
#ifdef HAVE_ONE_TIME_AUTH #ifdef HAVE_ONE_TIME_AUTH
if (!ssl->auth.setup && ssl->specs.bulk_cipher_algorithm == wolfssl_chacha){ if (!ssl->auth.setup && ssl->specs.bulk_cipher_algorithm == wolfssl_chacha){
ret = SetAuthKeys(&ssl->auth, keys, &ssl->specs, ssl->heap, devId); ret = SetAuthKeys(&ssl->auth, keys, &ssl->specs, ssl->heap, ssl->devId);
if (ret != 0) if (ret != 0)
return ret; return ret;
} }
#endif #endif
ret = SetKeys(wc_encrypt, wc_decrypt, keys, &ssl->specs, ssl->options.side, ret = SetKeys(wc_encrypt, wc_decrypt, keys, &ssl->specs, ssl->options.side,
ssl->heap, devId); ssl->heap, ssl->devId);
#ifdef HAVE_SECURE_RENEGOTIATION #ifdef HAVE_SECURE_RENEGOTIATION
if (copy) { if (copy) {