"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cipher/sha256.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).

sha256.c  (libgcrypt-1.9.1.tar.bz2):sha256.c  (libgcrypt-1.9.2.tar.bz2)
skipping to change at line 575 skipping to change at line 575
else if (hd->use_s390x_crypto) else if (hd->use_s390x_crypto)
{ {
burn = do_sha256_final_s390x (hd, hd->bctx.buf, hd->bctx.count, msb, lsb); burn = do_sha256_final_s390x (hd, hd->bctx.buf, hd->bctx.count, msb, lsb);
} }
#endif #endif
else if (hd->bctx.count < 56) /* enough room */ else 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 *
sha256_read (void *context) sha256_read (void *context)
{ {
SHA256_CONTEXT *hd = context; SHA256_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)