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:
16
src/tls13.c
16
src/tls13.c
@ -1681,9 +1681,13 @@ static int EncryptTls13(WOLFSSL* ssl, byte* output, const byte* input,
|
||||
#endif
|
||||
|
||||
nonceSz = AESGCM_NONCE_SZ;
|
||||
ret = wc_AesGcmEncrypt(ssl->encrypt.aes, output, input,
|
||||
dataSz, ssl->encrypt.nonce, nonceSz,
|
||||
ret = wc_AesGcmSetExtIV(ssl->encrypt.aes,
|
||||
ssl->encrypt.nonce, nonceSz);
|
||||
if (ret == 0) {
|
||||
ret = wc_AesGcmEncrypt_ex(ssl->encrypt.aes, output,
|
||||
input, dataSz, ssl->encrypt.nonce, nonceSz,
|
||||
output + dataSz, macSz, aad, aadSz);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
@ -1698,9 +1702,13 @@ static int EncryptTls13(WOLFSSL* ssl, byte* output, const byte* input,
|
||||
#endif
|
||||
|
||||
nonceSz = AESCCM_NONCE_SZ;
|
||||
ret = wc_AesCcmEncrypt(ssl->encrypt.aes, output, input,
|
||||
dataSz, ssl->encrypt.nonce, nonceSz,
|
||||
ret = wc_AesCcmSetNonce(ssl->encrypt.aes,
|
||||
ssl->encrypt.nonce, nonceSz);
|
||||
if (ret == 0) {
|
||||
ret = wc_AesCcmEncrypt_ex(ssl->encrypt.aes, output,
|
||||
input, dataSz, ssl->encrypt.nonce, nonceSz,
|
||||
output + dataSz, macSz, aad, aadSz);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user