[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ed58d8aa-c21d-9ae5-3a29-2683d39d2a35@linux.alibaba.com>
Date: Thu, 16 Sep 2021 11:26:26 +0800
From: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Boris Pismenny <borisp@...dia.com>,
John Fastabend <john.fastabend@...il.com>,
Daniel Borkmann <daniel@...earbox.net>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jia Zhang <zhang.jia@...ux.alibaba.com>,
"YiLin . Li" <YiLin.Li@...ux.alibaba.com>
Subject: Re: [PATCH] net/tls: support SM4 GCM/CCM algorithm
Hi Jakub,
On 9/16/21 4:06 AM, Jakub Kicinski wrote:
> On Wed, 15 Sep 2021 19:12:42 +0800 Tianjia Zhang wrote:
>> + memcpy(sm4_gcm_info->iv,
>> + cctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE,
>> + TLS_CIPHER_AES_GCM_128_IV_SIZE);
>> + memcpy(sm4_gcm_info->rec_seq, cctx->rec_seq,
>> + TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE);
>> + release_sock(sk);
>> + if (copy_to_user(optval, sm4_gcm_info, sizeof(*sm4_gcm_info)))
>> + rc = -EFAULT;
>> + break;
>> + }
>> + case TLS_CIPHER_SM4_CCM: {
>> + struct tls12_crypto_info_sm4_ccm *sm4_ccm_info =
>> + container_of(crypto_info,
>> + struct tls12_crypto_info_sm4_ccm, info);
>> +
>> + if (len != sizeof(*sm4_ccm_info)) {
>> + rc = -EINVAL;
>> + goto out;
>> + }
>> + lock_sock(sk);
>> + memcpy(sm4_ccm_info->iv,
>> + cctx->iv + TLS_CIPHER_AES_GCM_128_SALT_SIZE,
>> + TLS_CIPHER_AES_GCM_128_IV_SIZE);
>> + memcpy(sm4_ccm_info->rec_seq, cctx->rec_seq,
>> + TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE);
>
> Doesn't matter from the functional perspective but perhaps use the SM4
> defines rather than the AES ones, since they exist, anyway?
>
> With that fixed feel free to add my ack.
>
Thanks for pointing it out, I forgot to modify the macro name, this is
not my intention, I was careless. will fix it in v2.
Best regards,
Tianjia
Powered by blists - more mailing lists