From 5ca4adf0acc55dcdb0f12338926f371c97c8f889 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Tue, 12 Jun 2001 15:14:49 +0000 Subject: [PATCH] * 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. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13342 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/des/ChangeLog | 7 +++++++ src/lib/crypto/des/destest.c | 15 +++++++++------ src/lib/crypto/des/t_verify.c | 24 ++++++++++++------------ 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index 59e124871..243993a47 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,10 @@ +2001-06-12 Ezra Peisach + + * 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 * f_cbc.c (mit_des_cbc_encrypt): Do not use a variable named "encrypt". diff --git a/src/lib/crypto/des/destest.c b/src/lib/crypto/des/destest.c index 80a66c98a..fcddc49d6 100644 --- a/src/lib/crypto/des/destest.c +++ b/src/lib/crypto/des/destest.c @@ -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; } diff --git a/src/lib/crypto/des/t_verify.c b/src/lib/crypto/des/t_verify.c index 80b4432a1..8b6efe0e0 100644 --- a/src/lib/crypto/des/t_verify.c +++ b/src/lib/crypto/des/t_verify.c @@ -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); } -- 2.26.2