svn rev #22392: trunk/src/lib/crypto/

raeburn@MIT.EDU raeburn at MIT.EDU
Wed May 27 16:03:47 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22392
Commit By: raeburn
Log Message:
ticket: 6505
target_version: 1.7
tags: pullup
subject: 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.


Changed Files:
U   trunk/src/lib/crypto/t_prf.c
Modified: trunk/src/lib/crypto/t_prf.c
===================================================================
--- trunk/src/lib/crypto/t_prf.c	2009-05-26 09:53:43 UTC (rev 22391)
+++ trunk/src/lib/crypto/t_prf.c	2009-05-27 20:03:46 UTC (rev 22392)
@@ -40,7 +40,9 @@
   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 @@
 	      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");
 




More information about the cvs-krb5 mailing list