Re: [EXTERNAL] Re: what is a replacement for private_AES_set_encrypt_key and AES_encrypt functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/12/2018 10:43 AM, Ard Biesheuvel wrote:
On 12 March 2018 at 14:38, Vitaly Andrianov <vitalya@xxxxxx> wrote:
Hello,

The Texas Instruments keystone2 out-of-tree kernel uses the
private_AES_set_encrypt_key() and
the AES_encrypt() at the crypto HW acceleration driver.

The "crypto: arm/aes - replace bit-sliced OpenSSL NEON code" commit removed
those functions.
Here is a code, which calls the removed functions.

static inline int sa_aes_xcbc_subkey(u8 *sub_key1, u8 *sub_key2,
                                      u8 *sub_key3, const u8 *key,
                                      u16 key_sz)
{
         struct AES_KEY enc_key;

         if (private_AES_set_encrypt_key(key, (key_sz * 8), &enc_key)) {
                 pr_err("%s: failed to set enc key\n", __func__);
                 return -EINVAL;
         }

         if (sub_key1) {
                 memset(sub_key1, 0x01, AES_BLOCK_SIZE);
                 AES_encrypt(sub_key1, sub_key1, &enc_key);
         }

         if (sub_key2) {
                 memset(sub_key2, 0x02, AES_BLOCK_SIZE);
                 AES_encrypt(sub_key2, sub_key2, &enc_key);
         }

         if (sub_key3) {
                 memset(sub_key3, 0x03, AES_BLOCK_SIZE);
                 AES_encrypt(sub_key3, sub_key3, &enc_key);
         }

         return 0;
}

Which functions can I use to replace the removed ones in the above code?


Look at xcbc_setkey() in arch/arm64/crypto/aes-glue.c for an example

Ard,
Thank you very much.
-Vitaly



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux