+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".
krb5_octet zeroblock[8] = {0,0,0,0,0,0,0,0};
-void
+int
main(argc, argv)
int argc;
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,
/*
* 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,
{
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;
}
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);
}
}
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);
}