mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
Fix for min IV size check. Cleanup of the max IV to use new enum MAX_IV_SZ
.
This commit is contained in:
@ -13403,7 +13403,7 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input,
|
|||||||
args->ivSz = blockSz;
|
args->ivSz = blockSz;
|
||||||
args->sz += args->ivSz;
|
args->sz += args->ivSz;
|
||||||
|
|
||||||
if (args->ivSz > AES_BLOCK_SIZE)
|
if (args->ivSz > MAX_IV_SZ)
|
||||||
ERROR_OUT(BUFFER_E, exit_buildmsg);
|
ERROR_OUT(BUFFER_E, exit_buildmsg);
|
||||||
}
|
}
|
||||||
args->sz += 1; /* pad byte */
|
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);
|
AddRecordHeader(output, args->size, (byte)type, ssl);
|
||||||
|
|
||||||
/* write to output */
|
/* write to output */
|
||||||
if (args->ivSz) {
|
if (args->ivSz > 0) {
|
||||||
XMEMCPY(output + args->idx, args->iv,
|
XMEMCPY(output + args->idx, args->iv,
|
||||||
min(args->ivSz, sizeof(args->iv)));
|
min(args->ivSz, MAX_IV_SZ));
|
||||||
args->idx += args->ivSz;
|
args->idx += args->ivSz;
|
||||||
}
|
}
|
||||||
XMEMCPY(output + args->idx, input, inSz);
|
XMEMCPY(output + args->idx, input, inSz);
|
||||||
|
@ -1191,6 +1191,8 @@ enum Misc {
|
|||||||
AES_128_KEY_SIZE = 16,
|
AES_128_KEY_SIZE = 16,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
MAX_IV_SZ = AES_BLOCK_SIZE,
|
||||||
|
|
||||||
AEAD_SEQ_OFFSET = 4, /* Auth Data: Sequence number */
|
AEAD_SEQ_OFFSET = 4, /* Auth Data: Sequence number */
|
||||||
AEAD_TYPE_OFFSET = 8, /* Auth Data: Type */
|
AEAD_TYPE_OFFSET = 8, /* Auth Data: Type */
|
||||||
AEAD_VMAJ_OFFSET = 9, /* Auth Data: Major Version */
|
AEAD_VMAJ_OFFSET = 9, /* Auth Data: Major Version */
|
||||||
|
Reference in New Issue
Block a user