_krb5_aes_cts_encrypt no longer used.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23565 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -2222,74 +2222,6 @@ DES_PCBC_encrypt_key_ivec(krb5_context context,
|
||||
* AES draft-raeburn-krb-rijndael-krb-02
|
||||
*/
|
||||
|
||||
void KRB5_LIB_FUNCTION
|
||||
_krb5_aes_cts_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key,
|
||||
unsigned char *ivec, const int encryptp)
|
||||
{
|
||||
unsigned char tmp[AES_BLOCK_SIZE];
|
||||
int i;
|
||||
|
||||
/*
|
||||
* In the framework of kerberos, the length can never be shorter
|
||||
* then at least one blocksize.
|
||||
*/
|
||||
|
||||
if (encryptp) {
|
||||
|
||||
while(len > AES_BLOCK_SIZE) {
|
||||
for (i = 0; i < AES_BLOCK_SIZE; i++)
|
||||
tmp[i] = in[i] ^ ivec[i];
|
||||
AES_encrypt(tmp, out, key);
|
||||
memcpy(ivec, out, AES_BLOCK_SIZE);
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
tmp[i] = in[i] ^ ivec[i];
|
||||
for (; i < AES_BLOCK_SIZE; i++)
|
||||
tmp[i] = 0 ^ ivec[i];
|
||||
|
||||
AES_encrypt(tmp, out - AES_BLOCK_SIZE, key);
|
||||
|
||||
memcpy(out, ivec, len);
|
||||
memcpy(ivec, out - AES_BLOCK_SIZE, AES_BLOCK_SIZE);
|
||||
|
||||
} else {
|
||||
unsigned char tmp2[AES_BLOCK_SIZE];
|
||||
unsigned char tmp3[AES_BLOCK_SIZE];
|
||||
|
||||
while(len > AES_BLOCK_SIZE * 2) {
|
||||
memcpy(tmp, in, AES_BLOCK_SIZE);
|
||||
AES_decrypt(in, out, key);
|
||||
for (i = 0; i < AES_BLOCK_SIZE; i++)
|
||||
out[i] ^= ivec[i];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
len -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
len -= AES_BLOCK_SIZE;
|
||||
|
||||
memcpy(tmp, in, AES_BLOCK_SIZE); /* save last iv */
|
||||
AES_decrypt(in, tmp2, key);
|
||||
|
||||
memcpy(tmp3, in + AES_BLOCK_SIZE, len);
|
||||
memcpy(tmp3 + len, tmp2 + len, AES_BLOCK_SIZE - len); /* xor 0 */
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
out[i + AES_BLOCK_SIZE] = tmp2[i] ^ tmp3[i];
|
||||
|
||||
AES_decrypt(tmp3, out, key);
|
||||
for (i = 0; i < AES_BLOCK_SIZE; i++)
|
||||
out[i] ^= ivec[i];
|
||||
memcpy(ivec, tmp, AES_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
static krb5_error_code
|
||||
AES_CTS_encrypt(krb5_context context,
|
||||
struct key_data *key,
|
||||
|
Reference in New Issue
Block a user