Merge pull request #2890 from JacobBarthelmeh/Testing

set ChaCha counter state for TLS 1.3 AEAD
This commit is contained in:
Sean Parkinson
2020-04-09 10:28:50 +10:00
committed by GitHub

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;