From: Niels Möller Date: Sat, 28 Sep 2013 07:21:38 +0000 (+0200) Subject: MD_PAD: Don't depend on sizeof of the count field(s). X-Git-Tag: nettle_3.0_release_20140607~212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e9b73e098e7876df990a6f2740d4987ebc2f698;p=thirdparty%2Fnettle.git MD_PAD: Don't depend on sizeof of the count field(s). --- diff --git a/ChangeLog b/ChangeLog index 46bb9b56..72b692e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-09-28 Niels Möller + + * macros.h (MD_PAD): Use size argument, don't depend on + sizeof of the count field(s). + 2013-09-22 Niels Möller * x86_64/gcm-hash8.asm: New file. diff --git a/macros.h b/macros.h index c471c26d..fb814239 100644 --- a/macros.h +++ b/macros.h @@ -225,7 +225,7 @@ do { \ assert(__md_i < sizeof((ctx)->block)); \ (ctx)->block[__md_i++] = 0x80; \ \ - if (__md_i > (sizeof((ctx)->block) - 2*sizeof((ctx)->count_low))) \ + if (__md_i > (sizeof((ctx)->block) - (size))) \ { /* No room for length in this block. Process it and \ pad with another one */ \ memset((ctx)->block + __md_i, 0, sizeof((ctx)->block) - __md_i); \