set ChaCha counter state for TLS 1.3 AEAD

This commit is contained in:
Jacob Barthelmeh
2020-04-07 10:36:23 -06:00
parent 9a1687d00e
commit bf332b459b

View File

@ -1656,6 +1656,9 @@ static int ChaCha20Poly1305_Encrypt(WOLFSSL* ssl, byte* output,
return ret;
/* Create Poly1305 key using ChaCha20 keystream. */
ret = wc_Chacha_Process(ssl->encrypt.chacha, poly, poly, sizeof(poly));
if (ret != 0)
return ret;
ret = wc_Chacha_SetIV(ssl->encrypt.chacha, nonce, 1);
if (ret != 0)
return ret;
/* Encrypt the plain text. */
@ -1939,6 +1942,9 @@ static int ChaCha20Poly1305_Decrypt(WOLFSSL* ssl, byte* output,
return ret;
/* Use ChaCha20 keystream to get Poly1305 key for tag. */
ret = wc_Chacha_Process(ssl->decrypt.chacha, poly, poly, sizeof(poly));
if (ret != 0)
return ret;
ret = wc_Chacha_SetIV(ssl->decrypt.chacha, nonce, 1);
if (ret != 0)
return ret;