From 5b3eeda8b9d73acbd042c0fe332d8a05bf7ab4b0 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Sun, 6 Dec 2009 20:55:16 +0000 Subject: [PATCH] Remove the ivec parameters from the keyhash provider functions, as they are never used by callers. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23452 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/k5-int.h | 9 +++------ src/lib/crypto/crypto_tests/t_cksum.c | 8 ++++---- src/lib/crypto/krb/aead.c | 2 +- src/lib/crypto/krb/keyhash_provider/descbc.c | 7 ++----- src/lib/crypto/krb/keyhash_provider/hmac_md5.c | 6 +++--- src/lib/crypto/krb/keyhash_provider/k5_md4des.c | 5 ++--- src/lib/crypto/krb/keyhash_provider/k5_md5des.c | 9 ++++----- src/lib/crypto/krb/keyhash_provider/md5_hmac.c | 4 ++-- src/lib/crypto/krb/make_checksum.c | 4 ++-- src/lib/crypto/krb/verify_checksum.c | 5 ++--- src/lib/crypto/krb/verify_checksum_iov.c | 2 +- 11 files changed, 26 insertions(+), 35 deletions(-) diff --git a/src/include/k5-int.h b/src/include/k5-int.h index d16642e9e..2047bb989 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -675,20 +675,17 @@ struct krb5_keyhash_provider { size_t hashsize; krb5_error_code (*hash)(krb5_key key, krb5_keyusage keyusage, - const krb5_data *ivec, const krb5_data *input, - krb5_data *output); + const krb5_data *input, krb5_data *output); krb5_error_code (*verify)(krb5_key key, krb5_keyusage keyusage, - const krb5_data *ivec, const krb5_data *input, - const krb5_data *hash, krb5_boolean *valid); + const krb5_data *input, const krb5_data *hash, + krb5_boolean *valid); krb5_error_code (*hash_iov)(krb5_key key, krb5_keyusage keyusage, - const krb5_data *ivec, const krb5_crypto_iov *data, size_t num_data, krb5_data *output); krb5_error_code (*verify_iov)(krb5_key key, krb5_keyusage keyusage, - const krb5_data *ivec, const krb5_crypto_iov *data, size_t num_data, const krb5_data *hash, krb5_boolean *valid); diff --git a/src/lib/crypto/crypto_tests/t_cksum.c b/src/lib/crypto/crypto_tests/t_cksum.c index 5aca50f95..16a994fdb 100644 --- a/src/lib/crypto/crypto_tests/t_cksum.c +++ b/src/lib/crypto/crypto_tests/t_cksum.c @@ -127,13 +127,13 @@ main(argc, argv) plaintext.length = strlen(argv[msgindex]); plaintext.data = argv[msgindex]; - if ((kret = (*(khp.hash))(key, 0, 0, &plaintext, &newstyle_checksum))) { + if ((kret = (*(khp.hash))(key, 0, &plaintext, &newstyle_checksum))) { printf("krb5_calculate_checksum choked with %d\n", kret); break; } print_checksum("correct", MD, argv[msgindex], &newstyle_checksum); - if ((kret = (*(khp.verify))(key, 0, 0, &plaintext, &newstyle_checksum, + if ((kret = (*(khp.verify))(key, 0, &plaintext, &newstyle_checksum, &valid))) { printf("verify on new checksum choked with %d\n", kret); break; @@ -146,7 +146,7 @@ main(argc, argv) printf("Verify succeeded for \"%s\"\n", argv[msgindex]); newstyle_checksum.data[0]++; - if ((kret = (*(khp.verify))(key, 0, 0, &plaintext, &newstyle_checksum, + if ((kret = (*(khp.verify))(key, 0, &plaintext, &newstyle_checksum, &valid))) { printf("verify on new checksum choked with %d\n", kret); break; @@ -163,7 +163,7 @@ main(argc, argv) kret = 1; break; } - if ((kret = (*(khp.verify))(key, 0, 0, &plaintext, &knowncksum_dat, + if ((kret = (*(khp.verify))(key, 0, &plaintext, &knowncksum_dat, &valid))) { printf("verify on known checksum choked with %d\n", kret); break; diff --git a/src/lib/crypto/krb/aead.c b/src/lib/crypto/krb/aead.c index 7b95d588e..67835f4e5 100644 --- a/src/lib/crypto/krb/aead.c +++ b/src/lib/crypto/krb/aead.c @@ -79,7 +79,7 @@ krb5int_c_make_checksum_iov(const struct krb5_cksumtypes *cksum_type, if (cksum_type->keyhash->hash_iov == NULL) return KRB5_BAD_ENCTYPE; - ret = cksum_type->keyhash->hash_iov(key, usage, 0, data, num_data, + ret = cksum_type->keyhash->hash_iov(key, usage, data, num_data, cksum_data); } else if (cksum_type->flags & KRB5_CKSUMFLAG_DERIVE) { ret = krb5int_dk_make_checksum(cksum_type->hash, key, usage, data, diff --git a/src/lib/crypto/krb/keyhash_provider/descbc.c b/src/lib/crypto/krb/keyhash_provider/descbc.c index 1ed226020..95816676d 100644 --- a/src/lib/crypto/krb/keyhash_provider/descbc.c +++ b/src/lib/crypto/krb/keyhash_provider/descbc.c @@ -30,8 +30,8 @@ #include "keyhash_provider.h" static krb5_error_code -k5_descbc_hash(krb5_key key, krb5_keyusage usage, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) +k5_descbc_hash(krb5_key key, krb5_keyusage usage, const krb5_data *input, + krb5_data *output) { mit_des_key_schedule schedule; @@ -39,8 +39,6 @@ k5_descbc_hash(krb5_key key, krb5_keyusage usage, const krb5_data *ivec, return(KRB5_BAD_KEYSIZE); if ((input->length%8) != 0) return(KRB5_BAD_MSIZE); - if (ivec && (ivec->length != 8)) - return(KRB5_CRYPTO_INTERNAL); if (output->length != 8) return(KRB5_CRYPTO_INTERNAL); @@ -56,7 +54,6 @@ k5_descbc_hash(krb5_key key, krb5_keyusage usage, const krb5_data *ivec, mit_des_cbc_cksum((unsigned char *) input->data, (unsigned char *) output->data, input->length, schedule, - ivec? (const unsigned char *)ivec->data: (const unsigned char *)mit_des_zeroblock); memset(schedule, 0, sizeof(schedule)); diff --git a/src/lib/crypto/krb/keyhash_provider/hmac_md5.c b/src/lib/crypto/krb/keyhash_provider/hmac_md5.c index f522d0cc7..4da77effb 100644 --- a/src/lib/crypto/krb/keyhash_provider/hmac_md5.c +++ b/src/lib/crypto/krb/keyhash_provider/hmac_md5.c @@ -37,8 +37,8 @@ #include "../aead.h" static krb5_error_code -k5_hmac_md5_hash(krb5_key key, krb5_keyusage usage, const krb5_data *iv, - const krb5_data *input, krb5_data *output) +k5_hmac_md5_hash(krb5_key key, krb5_keyusage usage, const krb5_data *input, + krb5_data *output) { krb5_keyusage ms_usage; krb5_error_code ret; @@ -80,7 +80,7 @@ cleanup: } static krb5_error_code -k5_hmac_md5_hash_iov(krb5_key key, krb5_keyusage usage, const krb5_data *iv, +k5_hmac_md5_hash_iov(krb5_key key, krb5_keyusage usage, const krb5_crypto_iov *data, size_t num_data, krb5_data *output) { diff --git a/src/lib/crypto/krb/keyhash_provider/k5_md4des.c b/src/lib/crypto/krb/keyhash_provider/k5_md4des.c index 89e04bb34..c33f07f35 100644 --- a/src/lib/crypto/krb/keyhash_provider/k5_md4des.c +++ b/src/lib/crypto/krb/keyhash_provider/k5_md4des.c @@ -64,8 +64,8 @@ mk_xorkey(krb5_key origkey, krb5_key *xorkey) } static krb5_error_code -k5_md4des_hash(krb5_key key, krb5_keyusage usage, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) +k5_md4des_hash(krb5_key key, krb5_keyusage usage, const krb5_data *input, + krb5_data *output) { krb5_error_code ret; krb5_data data; @@ -113,7 +113,6 @@ k5_md4des_hash(krb5_key key, krb5_keyusage usage, const krb5_data *ivec, static krb5_error_code k5_md4des_verify(krb5_key key, krb5_keyusage usage, - const krb5_data *ivec, const krb5_data *input, const krb5_data *hash, krb5_boolean *valid) { diff --git a/src/lib/crypto/krb/keyhash_provider/k5_md5des.c b/src/lib/crypto/krb/keyhash_provider/k5_md5des.c index 2540e0b54..25dc61ce0 100644 --- a/src/lib/crypto/krb/keyhash_provider/k5_md5des.c +++ b/src/lib/crypto/krb/keyhash_provider/k5_md5des.c @@ -64,8 +64,8 @@ mk_xorkey(krb5_key origkey, krb5_key *xorkey) } static krb5_error_code -k5_md5des_hash(krb5_key key, krb5_keyusage usage, const krb5_data *ivec, - const krb5_data *input, krb5_data *output) +k5_md5des_hash(krb5_key key, krb5_keyusage usage, const krb5_data *input, + krb5_data *output) { krb5_error_code ret; krb5_data data; @@ -113,9 +113,8 @@ k5_md5des_hash(krb5_key key, krb5_keyusage usage, const krb5_data *ivec, } static krb5_error_code -k5_md5des_verify(krb5_key key, krb5_keyusage usage, const krb5_data *ivec, - const krb5_data *input, const krb5_data *hash, - krb5_boolean *valid) +k5_md5des_verify(krb5_key key, krb5_keyusage usage, const krb5_data *input, + const krb5_data *hash, krb5_boolean *valid) { krb5_error_code ret; krb5_MD5_CTX ctx; diff --git a/src/lib/crypto/krb/keyhash_provider/md5_hmac.c b/src/lib/crypto/krb/keyhash_provider/md5_hmac.c index 39b2c18ab..45a4e5d70 100644 --- a/src/lib/crypto/krb/keyhash_provider/md5_hmac.c +++ b/src/lib/crypto/krb/keyhash_provider/md5_hmac.c @@ -34,8 +34,8 @@ #include "hash_provider.h" static krb5_error_code -k5_md5_hmac_hash(krb5_key key, krb5_keyusage usage, const krb5_data *iv, - const krb5_data *input, krb5_data *output) +k5_md5_hmac_hash(krb5_key key, krb5_keyusage usage, const krb5_data *input, + krb5_data *output) { krb5_keyusage ms_usage; krb5_MD5_CTX ctx; diff --git a/src/lib/crypto/krb/make_checksum.c b/src/lib/crypto/krb/make_checksum.c index bc69dfb5c..2a0ede1c2 100644 --- a/src/lib/crypto/krb/make_checksum.c +++ b/src/lib/crypto/krb/make_checksum.c @@ -82,9 +82,9 @@ krb5_k_make_checksum(krb5_context context, krb5_cksumtype cksumtype, keyhash = ctp->keyhash; if (keyhash->hash == NULL) { assert(keyhash->hash_iov != NULL); - ret = (*keyhash->hash_iov)(key, usage, 0, &iov, 1, &data); + ret = (*keyhash->hash_iov)(key, usage, &iov, 1, &data); } else { - ret = (*keyhash->hash)(key, usage, 0, input, &data); + ret = (*keyhash->hash)(key, usage, input, &data); } } else if (ctp->flags & KRB5_CKSUMFLAG_DERIVE) { ret = krb5int_dk_make_checksum(ctp->hash, key, usage, &iov, 1, &data); diff --git a/src/lib/crypto/krb/verify_checksum.c b/src/lib/crypto/krb/verify_checksum.c index 3664abd02..177c5eb16 100644 --- a/src/lib/crypto/krb/verify_checksum.c +++ b/src/lib/crypto/krb/verify_checksum.c @@ -63,10 +63,9 @@ krb5_k_verify_checksum(krb5_context context, krb5_key key, iov[0].data.data = data->data; iov[0].data.length = data->length; - return (*keyhash->verify_iov)(key, usage, 0, iov, 1, &indata, - valid); + return (*keyhash->verify_iov)(key, usage, iov, 1, &indata, valid); } else if (keyhash->verify != NULL) { - return (*keyhash->verify)(key, usage, 0, data, &indata, valid); + return (*keyhash->verify)(key, usage, data, &indata, valid); } } diff --git a/src/lib/crypto/krb/verify_checksum_iov.c b/src/lib/crypto/krb/verify_checksum_iov.c index 19f1f5ed3..e0af46c0a 100644 --- a/src/lib/crypto/krb/verify_checksum_iov.c +++ b/src/lib/crypto/krb/verify_checksum_iov.c @@ -60,7 +60,7 @@ krb5_k_verify_checksum_iov(krb5_context context, /* If there's actually a verify function, call it. */ if (ctp->keyhash && ctp->keyhash->verify_iov) { - return (*ctp->keyhash->verify_iov)(key, usage, 0, data, num_data, + return (*ctp->keyhash->verify_iov)(key, usage, data, num_data, &checksum->data, valid); } -- 2.26.2