linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kamil Konieczny <k.konieczny@partner.samsung.com>
To: Christoph Manszewski <c.manszewski@samsung.com>,
	linux-crypto@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	Vladimir Zapolskiy <vz@mleia.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH v2 4/4] crypto: s5p-sss: Add aes-ctr support
Date: Mon, 17 Sep 2018 17:54:20 +0200	[thread overview]
Message-ID: <20180917155422eucas1p2ea33c73f046cb19c7be5fac7e9191059~VOvLUVLIR0418604186eucas1p2i@eucas1p2.samsung.com> (raw)
In-Reply-To: <20180917151011eucas1p274a1407a02081b49aa03da85cc9aec4c~VOImIjh2C1107511075eucas1p2w@eucas1p2.samsung.com>



On 17.09.2018 17:09, Christoph Manszewski wrote:
> Add support for aes counter(ctr) block cipher mode of operation for
> Exynos Hardware. In contrast to ecb and cbc modes, aes-ctr allows
> encyption/decryption for request sizes not being a multiple of 16(bytes).
> 
> Hardware requires block sizes being a multiple of 16(bytes). In order to
> achieve this, copy request source and destination memory, and align it's size
> to 16. That way hardware processes additional bytes, that are omitted
> when copying the result back to its original destination.
> 
> Tested on Odroid-U3 with Exynos 4412 CPU, kernel 4.19-rc2 with crypto
> run-time self test testmgr.
> 
> Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com>
> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  drivers/crypto/s5p-sss.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 40 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
> index ba8f2e2ea88f..0064be0e3941 100644
> --- a/drivers/crypto/s5p-sss.c
> +++ b/drivers/crypto/s5p-sss.c
> @@ -1813,7 +1813,7 @@ static struct ahash_alg algs_sha1_md5_sha256[] = {
>  };
>  
>  static void s5p_set_aes(struct s5p_aes_dev *dev,
> -			const u8 *key, const u8 *iv,
> +			const u8 *key, const u8 *iv, const u8 *ctr,
>  			unsigned int keylen)
>  {
>  	void __iomem *keystart;
> @@ -1821,6 +1821,9 @@ static void s5p_set_aes(struct s5p_aes_dev *dev,
>  	if (iv)
>  		memcpy_toio(dev->aes_ioaddr + SSS_REG_AES_IV_DATA(0), iv, 0x10);
>  
> +	if (ctr)
> +		memcpy_toio(dev->aes_ioaddr + SSS_REG_AES_CNT_DATA(0), ctr, 0x10);
> +
>  	if (keylen == AES_KEYSIZE_256)
>  		keystart = dev->aes_ioaddr + SSS_REG_AES_KEY_DATA(0);
>  	else if (keylen == AES_KEYSIZE_192)
> @@ -1902,8 +1905,9 @@ static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode)
>  	u32 aes_control;
>  	unsigned long flags;
>  	int err;
> -	u8 *iv;
> +	u8 *iv, *ctr;
>  
> +	/* This sets bit [13:12] to 00, which selects 128-bit counter */

s/bit/bits/

This this,

Acked-by: Kamil Konieczny <k.konieczny@partner.samsung.com>

Thanks!
Kamil

      reply	other threads:[~2018-09-17 15:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1537196970-5987-1-git-send-email-c.manszewski@samsung.com>
     [not found] ` <CGME20180917151006eucas1p2226806b94605b061bc1bc3e9b5a6c495@eucas1p2.samsung.com>
2018-09-17 15:09   ` [PATCH v2 1/4] crypto: s5p-sss: Fix race in error handling Christoph Manszewski
2018-09-17 15:47     ` Kamil Konieczny
2018-09-18  7:33     ` Krzysztof Kozlowski
     [not found] ` <CGME20180917151007eucas1p175be8c3c1119cff3189aa12722b21ca8@eucas1p1.samsung.com>
2018-09-17 15:09   ` [PATCH v2 2/4] crypto: s5p-sss: Fix Fix argument list alignment Christoph Manszewski
2018-09-17 15:47     ` Kamil Konieczny
     [not found] ` <CGME20180917151009eucas1p145fdde4a56241418a49a1da14c5bdb02@eucas1p1.samsung.com>
2018-09-17 15:09   ` [PATCH v2 3/4] crypto: s5p-sss: Minor code cleanup Christoph Manszewski
2018-09-17 15:49     ` Kamil Konieczny
     [not found] ` <CGME20180917151011eucas1p274a1407a02081b49aa03da85cc9aec4c@eucas1p2.samsung.com>
2018-09-17 15:09   ` [PATCH v2 4/4] crypto: s5p-sss: Add aes-ctr support Christoph Manszewski
2018-09-17 15:54     ` Kamil Konieczny [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='20180917155422eucas1p2ea33c73f046cb19c7be5fac7e9191059~VOvLUVLIR0418604186eucas1p2i@eucas1p2.samsung.com' \
    --to=k.konieczny@partner.samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=c.manszewski@samsung.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=krzk@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=vz@mleia.com \
    --subject='Re: [PATCH v2 4/4] crypto: s5p-sss: Add aes-ctr support' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).