From: Ken Raeburn Date: Wed, 13 Apr 2005 20:14:48 +0000 (+0000) Subject: * aes_s2k.c (krb5int_aes_string_to_key): Widen bytes of iteration count before shifting X-Git-Tag: ms-bug-test-20060525~287 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c473839ae11613c4af2494281f2aef658fb3d627;p=krb5.git * aes_s2k.c (krb5int_aes_string_to_key): Widen bytes of iteration count before shifting git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17181 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/aes/ChangeLog b/src/lib/crypto/aes/ChangeLog index 462e35897..047ab0bae 100644 --- a/src/lib/crypto/aes/ChangeLog +++ b/src/lib/crypto/aes/ChangeLog @@ -1,5 +1,8 @@ 2005-04-13 Ken Raeburn + * aes_s2k.c (krb5int_aes_string_to_key): Widen bytes of iteration + count before shifting. + * Makefile.in (all-unix): Don't build aes-gen by default, leave it for 'make check'. diff --git a/src/lib/crypto/aes/aes_s2k.c b/src/lib/crypto/aes/aes_s2k.c index 9d48bd0cb..68d3111bf 100644 --- a/src/lib/crypto/aes/aes_s2k.c +++ b/src/lib/crypto/aes/aes_s2k.c @@ -50,7 +50,11 @@ krb5int_aes_string_to_key(const struct krb5_enc_provider *enc, unsigned char *p = (unsigned char *) params->data; if (params->length != 4) return KRB5_ERR_BAD_S2K_PARAMS; - iter_count = ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3])); + /* The first two need casts in case 'int' is 16 bits. */ + iter_count = (((unsigned long)p[0] << 24) + | ((unsigned long)p[1] << 16) + | (p[2] << 8) + | (p[3])); if (iter_count == 0) { iter_count = (1L << 16) << 16; if (((iter_count >> 16) >> 16) != 1)