diff options
| author | Greg Hudson <ghudson@mit.edu> | 2009-12-06 16:23:11 +0000 |
|---|---|---|
| committer | Greg Hudson <ghudson@mit.edu> | 2009-12-06 16:23:11 +0000 |
| commit | 638fc9ce2cfdd2e8395471d974ec0d28d1b9064c (patch) | |
| tree | 31ea13f7a88d93b17c77f19a6b1eb66ad0fe8175 /src/lib/crypto/crypto_tests | |
| parent | 0c3ba5525f2e3fff51da72bdfaa35ce7dae9f800 (diff) | |
Make the libk5crypto hash_provider interface take crypto_iov lists
instead of lists of krb5_data. Make the base HMAC APIs take
crypto_iov lists and drop the _iov variants.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23450 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto/crypto_tests')
| -rw-r--r-- | src/lib/crypto/crypto_tests/t_hmac.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/lib/crypto/crypto_tests/t_hmac.c b/src/lib/crypto/crypto_tests/t_hmac.c index 2bb5ff331..1056ff62f 100644 --- a/src/lib/crypto/crypto_tests/t_hmac.c +++ b/src/lib/crypto/crypto_tests/t_hmac.c @@ -100,6 +100,8 @@ static krb5_error_code hmac1(const struct krb5_hash_provider *h, size_t blocksize, hashsize; krb5_error_code err; krb5_key k; + krb5_crypto_iov iov; + krb5_data d; printk(" test key", key); blocksize = h->blocksize; @@ -107,23 +109,23 @@ static krb5_error_code hmac1(const struct krb5_hash_provider *h, if (hashsize > sizeof(tmp)) abort(); if (key->length > blocksize) { - krb5_data d, d2; - d.data = (char *) key->contents; - d.length = key->length; - d2.data = tmp; - d2.length = hashsize; - err = h->hash (1, &d, &d2); + iov.flags = KRB5_CRYPTO_TYPE_DATA; + iov.data = make_data(key->contents, key->length); + d = make_data(tmp, hashsize); + err = h->hash(&iov, 1, &d); if (err) { com_err(whoami, err, "hashing key before calling hmac"); exit(1); } - key->length = d2.length; - key->contents = (krb5_octet *) d2.data; + key->length = d.length; + key->contents = (krb5_octet *) d.data; printk(" pre-hashed key", key); } printd(" hmac input", in); krb5_k_create_key(NULL, key, &k); - err = krb5int_hmac(h, k, 1, in, out); + iov.flags = KRB5_CRYPTO_TYPE_DATA; + iov.data = *in; + err = krb5int_hmac(h, k, &iov, 1, out); krb5_k_free_key(NULL, k); if (err == 0) printd(" hmac output", out); |
