From ea7327e39d2cf93533fece9d24e695cdd561b691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sat, 19 Jul 2003 07:34:12 +0000 Subject: [PATCH] (wrapped_length/wrapped_length_derived): when calculating the length of the encrypted data, use the keyed checksum length if the enctype supports a keyed checksum. This only matter for aes, for all other enctypes the key and unkeyed checksum have the same length. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12450 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/crypto.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/krb5/crypto.c b/lib/krb5/crypto.c index 4f99fb8fd..7fce8de1a 100644 --- a/lib/krb5/crypto.c +++ b/lib/krb5/crypto.c @@ -3586,9 +3586,15 @@ wrapped_length (krb5_context context, { struct encryption_type *et = crypto->et; size_t padsize = et->padsize; + size_t checksumsize; size_t res; - res = et->confoundersize + et->checksum->checksumsize + data_len; + if (et->keyed_checksum) + checksumsize = et->keyed_checksum->checksumsize; + else + checksumsize = et->checksum->checksumsize; + + res = et->confoundersize + checksumsize + data_len; res = (res + padsize - 1) / padsize * padsize; return res; } @@ -3604,7 +3610,10 @@ wrapped_length_dervied (krb5_context context, res = et->confoundersize + data_len; res = (res + padsize - 1) / padsize * padsize; - res += et->checksum->checksumsize; + if (et->keyed_checksum) + res += et->keyed_checksum->checksumsize; + else + res += et->checksum->checksumsize; return res; }