OCBv3: better taglen limitation

This commit is contained in:
Steffen Jaeckel 2017-08-03 13:40:57 +02:00
parent 3b4d39ea45
commit 3ecd18763b

View File

@ -51,8 +51,11 @@ int ocb3_decrypt_verify_memory(int cipher,
/* default to zero */ /* default to zero */
*stat = 0; *stat = 0;
/* limit taglen */
taglen = MIN(taglen, MAXBLOCKSIZE);
/* allocate memory */ /* allocate memory */
buf = XMALLOC(MIN(taglen, MAXBLOCKSIZE)); buf = XMALLOC(taglen);
ocb = XMALLOC(sizeof(ocb3_state)); ocb = XMALLOC(sizeof(ocb3_state));
if (ocb == NULL || buf == NULL) { if (ocb == NULL || buf == NULL) {
if (ocb != NULL) { if (ocb != NULL) {