forked from wolfSSL/wolfssl
Modify the TLSv1.3 calls to the AES-GCM and AES-CCM encrypt functions to
use the FIPS compatible APIs with external nonce.
This commit is contained in:
20
src/tls13.c
20
src/tls13.c
@@ -1681,9 +1681,13 @@ static int EncryptTls13(WOLFSSL* ssl, byte* output, const byte* input,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
nonceSz = AESGCM_NONCE_SZ;
|
nonceSz = AESGCM_NONCE_SZ;
|
||||||
ret = wc_AesGcmEncrypt(ssl->encrypt.aes, output, input,
|
ret = wc_AesGcmSetExtIV(ssl->encrypt.aes,
|
||||||
dataSz, ssl->encrypt.nonce, nonceSz,
|
ssl->encrypt.nonce, nonceSz);
|
||||||
output + dataSz, macSz, aad, aadSz);
|
if (ret == 0) {
|
||||||
|
ret = wc_AesGcmEncrypt_ex(ssl->encrypt.aes, output,
|
||||||
|
input, dataSz, ssl->encrypt.nonce, nonceSz,
|
||||||
|
output + dataSz, macSz, aad, aadSz);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1698,9 +1702,13 @@ static int EncryptTls13(WOLFSSL* ssl, byte* output, const byte* input,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
nonceSz = AESCCM_NONCE_SZ;
|
nonceSz = AESCCM_NONCE_SZ;
|
||||||
ret = wc_AesCcmEncrypt(ssl->encrypt.aes, output, input,
|
ret = wc_AesCcmSetNonce(ssl->encrypt.aes,
|
||||||
dataSz, ssl->encrypt.nonce, nonceSz,
|
ssl->encrypt.nonce, nonceSz);
|
||||||
output + dataSz, macSz, aad, aadSz);
|
if (ret == 0) {
|
||||||
|
ret = wc_AesCcmEncrypt_ex(ssl->encrypt.aes, output,
|
||||||
|
input, dataSz, ssl->encrypt.nonce, nonceSz,
|
||||||
|
output + dataSz, macSz, aad, aadSz);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user