From: Ken Raeburn Date: Wed, 27 May 2009 20:03:46 +0000 (+0000) Subject: fix t_prf test code properly X-Git-Tag: krb5-1.8-alpha1~451 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0ef1ec87f3996d995cb4dc03223a1474b2064e5f;p=krb5.git fix t_prf test code properly Correction to patch in r22364: "i" was used in two places, one of which required an int-sized value and the other of which required a size_t. Instead of changing the type, split the two uses into separate variables. ticket: 6505 target_version: 1.7 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22392 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/t_prf.c b/src/lib/crypto/t_prf.c index b3b8d08bb..ac244eb9a 100644 --- a/src/lib/crypto/t_prf.c +++ b/src/lib/crypto/t_prf.c @@ -40,7 +40,9 @@ int main () { krb5_data input, output; krb5_keyblock *key = NULL; unsigned int in_length; - size_t i; + unsigned int i; + size_t prfsz; + while (1) { krb5_enctype enctype; char s[1025]; @@ -65,17 +67,17 @@ int main () { input.data[in_length-lc] = (unsigned) (i&0xff); } input.length = in_length; - assert (krb5_c_prf_length(0, enctype, &i) == 0); - assert (output.data = malloc(i)); - output.length = i; + assert (krb5_c_prf_length(0, enctype, &prfsz) == 0); + assert (output.data = malloc(prfsz)); + output.length = prfsz; assert (krb5_c_prf(0, key, &input, &output) == 0); free (input.data); input.data = NULL; } - for (; i > 0; i--) { + for (; prfsz > 0; prfsz--) { printf ("%02x", - (unsigned int) ((unsigned char ) output.data[output.length-i])); + (unsigned int) ((unsigned char ) output.data[output.length-prfsz])); } printf ("\n");