aes-gcm wrap two new aes-gcm code bits with ifdef option

This commit is contained in:
John Safranek
2012-07-31 16:26:17 -07:00
parent 368afbb815
commit ab570a2130
2 changed files with 4 additions and 0 deletions

View File

@@ -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);

View File

@@ -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);