summaryrefslogtreecommitdiffstats
path: root/src/lib/crypto/krb/encrypt_length.c
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2009-12-04 05:12:35 +0000
committerGreg Hudson <ghudson@mit.edu>2009-12-04 05:12:35 +0000
commit5ffa313d9f6b7c509aa0d7579273150d71ea0f95 (patch)
tree48f8d5606c919dd09d950c5cbf1609f312f2937d /src/lib/crypto/krb/encrypt_length.c
parentea6f77d42700352fcb2a06444d1dc00acf7c20fc (diff)
downloadkrb5-5ffa313d9f6b7c509aa0d7579273150d71ea0f95.tar.gz
krb5-5ffa313d9f6b7c509aa0d7579273150d71ea0f95.tar.xz
krb5-5ffa313d9f6b7c509aa0d7579273150d71ea0f95.zip
Consolidate the IOV and non-IOV encryption/decryption code paths, and
drop the _iov suffix from most encryption- and decryption-related functions. The enc_provider encrypt and decrypt functions take IOVs, as do the enctype entries in etypes.c, and there are no separate encrypt_iov or decrypt_iov functions. aead_provider is gone. Enctype functions now take pointers to the enctype entry instead of pointers to the enc/hash/aead providers; this allows dk_encrypt and dk_decrypt to be polymorphic in the length function they use now that AES and DES3 can't differentiate by aead provider. aes_string_to_key needed to be moved into the krb/ fold for this since it's an enctype function; it was duplicated between builtin/ and openssl/ before. This leaves openssl/aes empty; the build system currently demands that all modules have the same directory structure, so the directory and Makefile will stick around for now. Three separate copies of the derive_random logic are also now consolidated into one. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23444 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto/krb/encrypt_length.c')
-rw-r--r--src/lib/crypto/krb/encrypt_length.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/crypto/krb/encrypt_length.c b/src/lib/crypto/krb/encrypt_length.c
index f270f8a22c..be99f17fa3 100644
--- a/src/lib/crypto/krb/encrypt_length.c
+++ b/src/lib/crypto/krb/encrypt_length.c
@@ -34,19 +34,16 @@ krb5_c_encrypt_length(krb5_context context, krb5_enctype enctype,
size_t inputlen, size_t *length)
{
const struct krb5_keytypes *ktp;
+ unsigned int header_len = 0, padding_len = 0, trailer_len = 0;
ktp = find_enctype(enctype);
if (ktp == NULL)
return KRB5_BAD_ENCTYPE;
- if (ktp->encrypt_len == NULL) {
- assert(ktp->aead != NULL);
-
- krb5int_c_encrypt_length_aead_compat(ktp->aead, ktp->enc, ktp->hash,
- inputlen, length);
- } else {
- (*ktp->encrypt_len)(ktp->enc, ktp->hash, inputlen, length);
- }
+ header_len = ktp->crypto_length(ktp, KRB5_CRYPTO_TYPE_HEADER);
+ padding_len = krb5int_c_padding_length(ktp, inputlen);
+ trailer_len = ktp->crypto_length(ktp, KRB5_CRYPTO_TYPE_TRAILER);
+ *length = header_len + inputlen + padding_len + trailer_len;
return 0;
}