"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cipher/sm3.c" between
libgcrypt-1.9.1.tar.bz2 and libgcrypt-1.9.2.tar.bz2

About: Libgcrypt is a general purpose library of cryptographic building blocks (originally based on GnuPG code).

sm3.c  (libgcrypt-1.9.1.tar.bz2):sm3.c  (libgcrypt-1.9.2.tar.bz2)
skipping to change at line 290 skipping to change at line 290
t = lsb; t = lsb;
lsb <<= 3; lsb <<= 3;
msb <<= 3; msb <<= 3;
msb |= t >> 29; msb |= t >> 29;
if (hd->bctx.count < 56) /* enough room */ if (hd->bctx.count < 56) /* enough room */
{ {
hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad */ hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad */
if (hd->bctx.count < 56) if (hd->bctx.count < 56)
memset (&hd->bctx.buf[hd->bctx.count], 0, 56 - hd->bctx.count); memset (&hd->bctx.buf[hd->bctx.count], 0, 56 - hd->bctx.count);
hd->bctx.count = 56;
/* append the 64 bit count */ /* append the 64 bit count */
buf_put_be32(hd->bctx.buf + 56, msb); buf_put_be32(hd->bctx.buf + 56, msb);
buf_put_be32(hd->bctx.buf + 60, lsb); buf_put_be32(hd->bctx.buf + 60, lsb);
burn = (*hd->bctx.bwrite) ( hd, hd->bctx.buf, 1 ); burn = (*hd->bctx.bwrite) ( hd, hd->bctx.buf, 1 );
} }
else /* need one extra block */ else /* need one extra block */
{ {
hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad character */ hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad character */
/* fill pad and next block with zeroes */ /* fill pad and next block with zeroes */
memset (&hd->bctx.buf[hd->bctx.count], 0, 64 - hd->bctx.count + 56); memset (&hd->bctx.buf[hd->bctx.count], 0, 64 - hd->bctx.count + 56);
hd->bctx.count = 64 + 56;
/* append the 64 bit count */ /* append the 64 bit count */
buf_put_be32(hd->bctx.buf + 64 + 56, msb); buf_put_be32(hd->bctx.buf + 64 + 56, msb);
buf_put_be32(hd->bctx.buf + 64 + 60, lsb); buf_put_be32(hd->bctx.buf + 64 + 60, lsb);
burn = (*hd->bctx.bwrite) ( hd, hd->bctx.buf, 2 ); burn = (*hd->bctx.bwrite) ( hd, hd->bctx.buf, 2 );
} }
p = hd->bctx.buf; p = hd->bctx.buf;
#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0) #define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
X(0); X(0);
X(1); X(1);
X(2); X(2);
X(3); X(3);
X(4); X(4);
X(5); X(5);
X(6); X(6);
X(7); X(7);
#undef X #undef X
hd->bctx.count = 0;
_gcry_burn_stack (burn); _gcry_burn_stack (burn);
} }
static byte * static byte *
sm3_read (void *context) sm3_read (void *context)
{ {
SM3_CONTEXT *hd = context; SM3_CONTEXT *hd = context;
return hd->bctx.buf; return hd->bctx.buf;
} }
 End of changes. 3 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)