* ext/digest/sha2/sha2.c: Merge from rough. Fix a couple of
off-by-one errors in Aaron Gifford's code. Obtained from: KAME via FreeBSD KAME PR: 393 FreeBSD PR: kern/34242 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9b137dcb90
commit
4e840877aa
@ -1,3 +1,12 @@
|
|||||||
|
Wed Feb 27 07:05:17 2002 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* ext/digest/sha2/sha2.c: Merge from rough. Fix a couple of
|
||||||
|
off-by-one errors in Aaron Gifford's code.
|
||||||
|
|
||||||
|
Obtained from: KAME via FreeBSD
|
||||||
|
KAME PR: 393
|
||||||
|
FreeBSD PR: kern/34242
|
||||||
|
|
||||||
Tue Feb 26 21:34:07 2002 Usaku Nakamura <usa@ruby-lang.org>
|
Tue Feb 26 21:34:07 2002 Usaku Nakamura <usa@ruby-lang.org>
|
||||||
|
|
||||||
* bignum.c (rb_big_2comp): void function cannot return any value.
|
* bignum.c (rb_big_2comp): void function cannot return any value.
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $RoughId: sha2.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
|
/* $RoughId: sha2.c,v 1.3 2002/02/26 22:03:36 knu Exp $ */
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -533,7 +533,7 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
|
|||||||
/* Begin padding with a 1 bit: */
|
/* Begin padding with a 1 bit: */
|
||||||
context->buffer[usedspace++] = 0x80;
|
context->buffer[usedspace++] = 0x80;
|
||||||
|
|
||||||
if (usedspace < SHA256_SHORT_BLOCK_LENGTH) {
|
if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
|
||||||
/* Set-up for the last transform: */
|
/* Set-up for the last transform: */
|
||||||
MEMSET_BZERO(&context->buffer[usedspace], SHA256_SHORT_BLOCK_LENGTH - usedspace);
|
MEMSET_BZERO(&context->buffer[usedspace], SHA256_SHORT_BLOCK_LENGTH - usedspace);
|
||||||
} else {
|
} else {
|
||||||
@ -824,7 +824,7 @@ void SHA512_Last(SHA512_CTX* context) {
|
|||||||
/* Begin padding with a 1 bit: */
|
/* Begin padding with a 1 bit: */
|
||||||
context->buffer[usedspace++] = 0x80;
|
context->buffer[usedspace++] = 0x80;
|
||||||
|
|
||||||
if (usedspace < SHA512_SHORT_BLOCK_LENGTH) {
|
if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
|
||||||
/* Set-up for the last transform: */
|
/* Set-up for the last transform: */
|
||||||
MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace);
|
MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user