From: Zhanna Tsitkov Date: Fri, 16 Oct 2009 17:14:14 +0000 (+0000) Subject: Fix the value of ivec in aes_decrypt_iov X-Git-Tag: krb5-1.8-alpha1~299 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f84299efd3bcd9932bebcc473c57f8886ff77c8c;p=krb5.git Fix the value of ivec in aes_decrypt_iov git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22905 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/builtin/enc_provider/aes.c b/src/lib/crypto/builtin/enc_provider/aes.c index c0e1606a0..934bc63a2 100644 --- a/src/lib/crypto/builtin/enc_provider/aes.c +++ b/src/lib/crypto/builtin/enc_provider/aes.c @@ -338,6 +338,9 @@ krb5int_aes_decrypt_iov(const krb5_keyblock *key, krb5int_c_iov_get_block((unsigned char *)blockN2, BLOCK_SIZE, data, num_data, &input_pos); krb5int_c_iov_get_block((unsigned char *)blockN1, BLOCK_SIZE, data, num_data, &input_pos); + if (ivec != NULL) + memcpy(ivec->data, blockN2, BLOCK_SIZE); + /* Decrypt second last block */ dec(tmp2, blockN2, &ctx); /* Set tmp2 to last (possibly partial) plaintext block, and @@ -351,9 +354,6 @@ krb5int_aes_decrypt_iov(const krb5_keyblock *key, memcpy(tmp2, blockN1, input_length ? input_length : BLOCK_SIZE); dec(tmp3, tmp2, &ctx); xorblock(tmp3, tmp); - /* Copy out ivec first before we clobber blockN1 with plaintext */ - if (ivec != NULL) - memcpy(ivec->data, blockN1, BLOCK_SIZE); memcpy(blockN1, tmp3, BLOCK_SIZE); /* Put the last two blocks back into the iovec */