* destest.c: main returns int instead of void. Add "const" to
authorEzra Peisach <epeisach@mit.edu>
Tue, 12 Jun 2001 15:14:49 +0000 (15:14 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 12 Jun 2001 15:14:49 +0000 (15:14 +0000)
casts in calls to mit_des_cbc_encrypt().

* t_verify.c (main): Add parenthesis aroud assignment in conditional.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13342 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/des/ChangeLog
src/lib/crypto/des/destest.c
src/lib/crypto/des/t_verify.c

index 59e124871a0afe0a9737f21db824ebad0629b922..243993a4781de757754e4a1febeb1edca48fd139 100644 (file)
@@ -1,3 +1,10 @@
+2001-06-12  Ezra Peisach  <epeisach@mit.edu>
+
+       * destest.c: main returns int instead of void.  Add "const" to
+       casts in calls to mit_des_cbc_encrypt().
+
+       * t_verify.c (main): Add parenthesis aroud assignment in conditional. 
+
 2001-05-31  Ezra Peisach  <epeisach@mit.edu>
 
        * f_cbc.c (mit_des_cbc_encrypt): Do not use a variable named "encrypt".
index 80a66c98a9b7243a21560ef4cd09eda22c0ec4ec..fcddc49d6db8cbae985b07b43d51fb911fb1f59b 100644 (file)
@@ -65,7 +65,7 @@ void des_cblock_print_file (mit_des_cblock, FILE *);
 
 krb5_octet zeroblock[8] = {0,0,0,0,0,0,0,0};
 
-void
+int
 main(argc, argv)
 int argc;
 char *argv[];
@@ -84,11 +84,13 @@ char *argv[];
        convert(block2, input);
        convert(block3, output);
 
-       if (retval = mit_des_key_sched(key, sched)) {
+       retval = mit_des_key_sched(key, sched);
+       if (retval) {
             fprintf(stderr, "des test: can't process key");
             exit(1);
         }
-       mit_des_cbc_encrypt(&input, &output2, 8, sched, zeroblock, 1);
+       mit_des_cbc_encrypt((const mit_des_cblock *) &input, &output2, 8, 
+                           sched, zeroblock, 1);
 
        if (memcmp((char *)output2, (char *)output, 8)) {
            fprintf(stderr, 
@@ -102,7 +104,8 @@ char *argv[];
        /*
         * Now try decrypting....
         */
-       mit_des_cbc_encrypt(&output, &output2, 8, sched, zeroblock, 0);
+       mit_des_cbc_encrypt((const mit_des_cblock *) &output, &output2, 8, 
+                           sched, zeroblock, 0);
 
        if (memcmp((char *)output2, (char *)input, 8)) {
            fprintf(stderr, 
@@ -150,11 +153,11 @@ unsigned char cblock[];
 {
     register int i;
     for (i = 0; i < 8; i++) {
-       if (value[text[i*2]] == -1 || value[text[i*2+1]] == -1) {
+       if (value[(int) text[i*2]] == -1 || value[(int) text[i*2+1]] == -1) {
            printf("Bad value byte %d in %s\n", i, text);
            exit(1);
        }
-       cblock[i] = 16*value[text[i*2]] + value[text[i*2+1]];
+       cblock[i] = 16*value[(int) text[i*2]] + value[(int) text[i*2+1]];
     }
     return;
 }
index 80b4432a1c623d9deefb7bbc6e0781bd43907621..8b6efe0e03302c05934f62b602e3e75ed32e1581 100644 (file)
@@ -273,12 +273,12 @@ main(argc,argv)
 
     printf("ACTUAL CBC\n\tclear \"%s\"\n",input);
     in_length =  strlen((char *)input);
-    if (retval = mit_des_cbc_encrypt((const mit_des_cblock *) input,
-                                    (mit_des_cblock *) cipher_text,
-                                    (size_t) in_length, 
-                                    sched,
-                                    ivec,
-                                    MIT_DES_ENCRYPT)) {
+    if ((retval = mit_des_cbc_encrypt((const mit_des_cblock *) input,
+                                     (mit_des_cblock *) cipher_text,
+                                     (size_t) in_length, 
+                                     sched,
+                                     ivec,
+                                     MIT_DES_ENCRYPT))) {
        com_err("des verify", retval, "can't encrypt");
        exit(-1);
     }
@@ -290,12 +290,12 @@ main(argc,argv)
        }
        printf("\n");
     }
-    if (retval = mit_des_cbc_encrypt((const mit_des_cblock *) cipher_text,
-                                    (mit_des_cblock *) clear_text,
-                                    (size_t) in_length, 
-                                    sched,
-                                    ivec,
-                                    MIT_DES_DECRYPT)) {
+    if ((retval = mit_des_cbc_encrypt((const mit_des_cblock *) cipher_text,
+                                     (mit_des_cblock *) clear_text,
+                                     (size_t) in_length, 
+                                     sched,
+                                     ivec,
+                                     MIT_DES_DECRYPT))) {
        com_err("des verify", retval, "can't decrypt");
        exit(-1);
     }