From: Ezra Peisach Date: Wed, 5 Dec 2001 23:16:28 +0000 (+0000) Subject: * yarrow.c (krb5int_yarrow_stretch): Delare local variable unsigned. X-Git-Tag: krb5-1.3-alpha1~921 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3511d6915f2dab45f961ae616da4ad44405f8318;p=krb5.git * yarrow.c (krb5int_yarrow_stretch): Delare local variable unsigned. (krb5int_yarrow_init): Zero cipher context on init. * yhash.h (HASH_Final): Use a variable other than out (shadow in yarrow.c) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14047 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/yarrow/ChangeLog b/src/lib/crypto/yarrow/ChangeLog index d5f52f577..441e00466 100644 --- a/src/lib/crypto/yarrow/ChangeLog +++ b/src/lib/crypto/yarrow/ChangeLog @@ -1,3 +1,11 @@ +2001-12-05 Ezra Peisach + + * yarrow.c (krb5int_yarrow_stretch): Delare local variable unsigned. + (krb5int_yarrow_init): Zero cipher context on init. + + * yhash.h (HASH_Final): Use a variable other than out (shadow in + yarrow.c) + 2001-11-21 Sam Hartman * yarrow.c (Yarrow_detect_fork): Reseed the number generator including the fork rather than throwing away state. diff --git a/src/lib/crypto/yarrow/yarrow.c b/src/lib/crypto/yarrow/yarrow.c index b4e5a218e..aee91ab68 100644 --- a/src/lib/crypto/yarrow/yarrow.c +++ b/src/lib/crypto/yarrow/yarrow.c @@ -187,6 +187,8 @@ int krb5int_yarrow_init(Yarrow_CTX* y, const char *filename) mem_zero(y->K, sizeof(y->K)); + mem_zero(&y->cipher, sizeof(y->cipher)); + TRY (krb5int_yarrow_cipher_init(&y->cipher, y->K)); y->out_left = 0; y->out_count = 0; @@ -757,7 +759,8 @@ int krb5int_yarrow_stretch(const byte* m, size_t size, byte* out, size_t out_siz EXCEP_DECL; const byte* s_i; byte* outp; - int left, use; + int left; + unsigned int use; HASH_CTX hash, save; byte digest[HASH_DIGEST_SIZE]; diff --git a/src/lib/crypto/yarrow/yhash.h b/src/lib/crypto/yarrow/yhash.h index 24208a6b5..aaa739fe1 100644 --- a/src/lib/crypto/yarrow/yhash.h +++ b/src/lib/crypto/yarrow/yhash.h @@ -16,14 +16,14 @@ #define HASH_Update(x, buf, sz) shsUpdate(x, (const void*)buf, sz) #define HASH_Final(x, tdigest) do { \ int loopvar; \ - unsigned char *out = (void *)(tdigest); \ + unsigned char *out2 = (void *)(tdigest); \ HASH_CTX *ctx = (x); \ shsFinal(ctx); \ for (loopvar=0; loopvar<(sizeof(ctx->digest)/sizeof(ctx->digest[0])); loopvar++) { \ - out[loopvar*4] = (ctx->digest[loopvar]>>24)&0xff; \ - out[loopvar*4+1] = (ctx->digest[loopvar]>>16)&0xff; \ - out[loopvar*4+2] = (ctx->digest[loopvar]>>8)&0xff; \ - out[loopvar*4+3] = ctx->digest[loopvar]&0xff; \ + out2[loopvar*4] = (ctx->digest[loopvar]>>24)&0xff; \ + out2[loopvar*4+1] = (ctx->digest[loopvar]>>16)&0xff; \ + out2[loopvar*4+2] = (ctx->digest[loopvar]>>8)&0xff; \ + out2[loopvar*4+3] = ctx->digest[loopvar]&0xff; \ } \ } while(0)