All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@freescale.com>
To: "linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Cc: "herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
	"Phillips Kim-R1AAHA" <Kim.Phillips@freescale.com>
Subject: Re: [PATCH v2 2/2] crypto: caam - add support for rfc4106(gcm(aes))
Date: Wed, 15 Oct 2014 16:01:03 +0300	[thread overview]
Message-ID: <543E700F.2090107@freescale.com> (raw)
In-Reply-To: <1413278237-18945-1-git-send-email-tudor.ambarus@freescale.com>



On 10/14/2014 12:17 PM, Tudor Ambarus wrote:

> +static int rfc4106_setkey(struct crypto_aead *aead,
> +			  const u8 *key, unsigned int keylen)
> +{
> +	struct caam_ctx *ctx = crypto_aead_ctx(aead);
> +	struct device *jrdev = ctx->jrdev;
> +	int ret = 0;
> +
> +	/*
> +	 * The last four bytes of the key material are used as the salt value
> +	 * in the nonce. Update the AES key length.
> +	 */
> +	if (keylen < 4)
> +		return -EINVAL;
> +	keylen -= 4;

The salt will not be copied in the ctx->key, so the descriptors will use 
as a salt whatever resides in memory after (updated) keylen bytes.

I will submit a new patch set in which I will update the AES key length 
after copying the key material in ctx->key.

tcrypt tests passed because they use salt values of zero.
Back-to-back tests passed because I used caam with rfc4106 accelerated 
on both boards.

> +
> +#ifdef DEBUG
> +	print_hex_dump(KERN_ERR, "key in @"__stringify(__LINE__)": ",
> +		       DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
> +#endif
> +
> +	memcpy(ctx->key, key, keylen);

  reply	other threads:[~2014-10-15 13:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-09 14:54 [PATCH 1/2] crypto: caam - add support for gcm(aes) Tudor Ambarus
2014-10-09 14:54 ` [PATCH 2/2] crypto: caam - add support for rfc4106(gcm(aes)) Tudor Ambarus
2014-10-10  0:43   ` Kim Phillips
2014-10-10 10:10     ` tudor.ambarus
2014-10-10 14:43       ` Kim Phillips
2014-10-14  9:17         ` [PATCH v2 " Tudor Ambarus
2014-10-15 13:01           ` Tudor Ambarus [this message]
2014-10-15 13:07             ` [PATCH " Tudor Ambarus
2014-10-23 13:14             ` [PATCH v3 " Tudor Ambarus
2014-10-10  0:43 ` [PATCH 1/2] crypto: caam - add support for gcm(aes) Kim Phillips
2014-10-10  8:47   ` tudor.ambarus
2014-10-10 14:36     ` Kim Phillips
2014-10-14  9:12       ` [PATCH v2 " Tudor Ambarus
2014-10-23 13:11       ` [PATCH v3 " Tudor Ambarus
2014-10-24 14:55         ` Herbert Xu

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=543E700F.2090107@freescale.com \
    --to=tudor.ambarus@freescale.com \
    --cc=Kim.Phillips@freescale.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.