forked from wolfSSL/wolfssl
aes-gcm wrap two new aes-gcm code bits with ifdef option
This commit is contained in:
@@ -3002,11 +3002,13 @@ static int BuildMessage(CYASSL* ssl, byte* output, const byte* input, int inSz,
|
||||
sz += pad;
|
||||
}
|
||||
|
||||
#ifdef BUILD_AESGCM
|
||||
if (ssl->specs.cipher_type == aead) {
|
||||
ivSz = AES_GCM_EXP_IV_SZ;
|
||||
sz += (ivSz + 16 - digestSz);
|
||||
AesGcmGetExpIV(&ssl->encrypt.aes, iv);
|
||||
}
|
||||
#endif
|
||||
size = (word16)(sz - headerSz); /* include mac and digest */
|
||||
AddRecordHeader(output, size, (byte)type, ssl);
|
||||
|
||||
|
@@ -1043,6 +1043,7 @@ int StoreKeys(CYASSL* ssl, const byte* keyData)
|
||||
XMEMCPY(ssl->keys.server_write_MAC_secret,&keyData[i], sz);
|
||||
i += sz;
|
||||
}
|
||||
#ifdef BUILD_AESGCM
|
||||
else if (ssl->specs.bulk_cipher_algorithm == aes_gcm) {
|
||||
byte iv[AES_GCM_EXP_IV_SZ];
|
||||
|
||||
@@ -1050,6 +1051,7 @@ int StoreKeys(CYASSL* ssl, const byte* keyData)
|
||||
RNG_GenerateBlock(&ssl->rng, iv, sizeof(iv));
|
||||
AesGcmSetExpIV(&ssl->encrypt.aes, iv);
|
||||
}
|
||||
#endif
|
||||
|
||||
sz = ssl->specs.key_size;
|
||||
XMEMCPY(ssl->keys.client_write_key, &keyData[i], sz);
|
||||
|
Reference in New Issue
Block a user