Browse Source

OCBv3: better taglen limitation

Steffen Jaeckel 8 năm trước cách đây
mục cha
commit
3ecd18763b
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      src/encauth/ocb3/ocb3_decrypt_verify_memory.c

+ 4 - 1
src/encauth/ocb3/ocb3_decrypt_verify_memory.c

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