mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Boris Pismenny <borisp@nvidia.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jia Zhang <zhang.jia@linux.alibaba.com>,
	"YiLin . Li" <YiLin.Li@linux.alibaba.com>
Subject: Re: [PATCH] net/tls: support SM4 GCM/CCM algorithm
Date: Thu, 16 Sep 2021 11:26:26 +0800	[thread overview]
Message-ID: <ed58d8aa-c21d-9ae5-3a29-2683d39d2a35@linux.alibaba.com> (raw)
In-Reply-To: <20210915130600.66ce8b26@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

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

      reply	other threads:[~2021-09-16  3:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15 11:12 Tianjia Zhang
2021-09-15 20:06 ` Jakub Kicinski
2021-09-16  3:26   ` Tianjia Zhang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ed58d8aa-c21d-9ae5-3a29-2683d39d2a35@linux.alibaba.com \
    --to=tianjia.zhang@linux.alibaba.com \
    --cc=YiLin.Li@linux.alibaba.com \
    --cc=borisp@nvidia.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=zhang.jia@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®