Fix for min IV size check. Cleanup of the max IV to use new enum MAX_IV_SZ
.
This commit is contained in:
parent
64ba151c35
commit
623f1b58ac
@ -13403,7 +13403,7 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input,
|
||||
args->ivSz = blockSz;
|
||||
args->sz += args->ivSz;
|
||||
|
||||
if (args->ivSz > AES_BLOCK_SIZE)
|
||||
if (args->ivSz > MAX_IV_SZ)
|
||||
ERROR_OUT(BUFFER_E, exit_buildmsg);
|
||||
}
|
||||
args->sz += 1; /* pad byte */
|
||||
@ -13455,9 +13455,9 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input,
|
||||
AddRecordHeader(output, args->size, (byte)type, ssl);
|
||||
|
||||
/* write to output */
|
||||
if (args->ivSz) {
|
||||
if (args->ivSz > 0) {
|
||||
XMEMCPY(output + args->idx, args->iv,
|
||||
min(args->ivSz, sizeof(args->iv)));
|
||||
min(args->ivSz, MAX_IV_SZ));
|
||||
args->idx += args->ivSz;
|
||||
}
|
||||
XMEMCPY(output + args->idx, input, inSz);
|
||||
|
@ -1191,6 +1191,8 @@ enum Misc {
|
||||
AES_128_KEY_SIZE = 16,
|
||||
#endif
|
||||
|
||||
MAX_IV_SZ = AES_BLOCK_SIZE,
|
||||
|
||||
AEAD_SEQ_OFFSET = 4, /* Auth Data: Sequence number */
|
||||
AEAD_TYPE_OFFSET = 8, /* Auth Data: Type */
|
||||
AEAD_VMAJ_OFFSET = 9, /* Auth Data: Major Version */
|
||||
|
Loading…
x
Reference in New Issue
Block a user