qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-2.9 1/2] cryptodev: fix the check of aes alg


From: Longpeng (Mike)
Subject: Re: [Qemu-devel] [PATCH for-2.9 1/2] cryptodev: fix the check of aes algorithm
Date: Mon, 5 Dec 2016 17:51:43 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

Hi Gonglei,

On 2016/12/5 17:34, Gonglei (Arei) wrote:

> 
......
>>
>> +#define AES_KEYSIZE_128 16
>> +#define AES_KEYSIZE_128_XTS 32
>> +#define AES_KEYSIZE_192 24
>> +#define AES_KEYSIZE_256 32
>> +#define AES_KEYSIZE_256_XTS 64
>> +
>>  static int
>> -cryptodev_builtin_get_aes_algo(uint32_t key_len, Error **errp)
>> +cryptodev_builtin_get_aes_algo(uint32_t key_len, int mode, Error **errp)
>>  {
>>      int algo;
>>
>> -    if (key_len == 128 / 8) {
>> +    if (key_len == AES_KEYSIZE_128) {
>>          algo = QCRYPTO_CIPHER_ALG_AES_128;
>> -    } else if (key_len == 192 / 8) {
>> +    } else if (key_len == AES_KEYSIZE_192) {
>>          algo = QCRYPTO_CIPHER_ALG_AES_192;
>> -    } else if (key_len == 256 / 8) {
>> -        algo = QCRYPTO_CIPHER_ALG_AES_256;
>> +    } else if (key_len == AES_KEYSIZE_256) { /* equals AES_KEYSIZE_128_XTS
>> */
> 
> So I think you can:
>       #define AES_KEYSIZE_128_XTS  AES_KEYSIZE_256


All right,  I send a V2 later. :)

> 
> 
> Regards,
> -Gonglei
> 
......
> 


-- 
Regards,
Longpeng(Mike)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]