linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gary R Hook <ghook@amd.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	Denis B <begun.denis@gmail.com>
Cc: <linux-crypto@vger.kernel.org>
Subject: Re: IV generation in cryptographic driver in AEAD
Date: Fri, 20 May 2016 10:50:38 -0500	[thread overview]
Message-ID: <573F324E.7000100@amd.com> (raw)
In-Reply-To: <20160520041901.GA2645@gondor.apana.org.au>

On 05/19/2016 11:19 PM, Herbert Xu wrote:
> Denis B <begun.denis@gmail.com> wrote:
>> My algs struct now looks like this:
>>
>> static struct crypto_alg pp_crypto_algs[] = {
>>    {
>>       .cra_name = "authenc(hmac(sha256),cbc(aes))",
>>       .cra_driver_name = "pp_crypto_cbc_hmac_sha256",
>>       .cra_priority = 1, /**TODO set to highest values after
>> implementing encrypt decrypt functions */
>>       .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
>>       .cra_blocksize = AES_BLOCK_SIZE,
>>       .cra_ctxsize = sizeof(struct pp_crypto_aead_ctx),
>>       .cra_type = &crypto_nivaead_type,
>>       .cra_u = {
>>             .aead = {
>>                 .setkey = pp_crypto_aead_setkey,
>>                 .setauthsize = pp_crypto_aead_setauthsize,
>>                 .decrypt = pp_crypto_aead_dec,
>>                 .encrypt = pp_crypto_aead_enc,
>>                 .givencrypt = NULL,
>>                 .givdecrypt = NULL,
>>                 .ivsize = AES_BLOCK_SIZE,
>>                 .maxauthsize = SHA256_DIGEST_SIZE,
>
> You also need to set geniv to "eseqiv".

I just gotta ask. Forgive my ignorance.

Why is (or should) setting geniv (be) required?

crypto_givcipher_default() appears to call crypto_default_geniv() if the 
geniv member
is NULL. That function returns "eseqiv" or "chainiv" (under certain 
conditions). If an
implementation isn't generating its own IVs, shouldn't the default 
happen anyway? Or is
this more a matter of populating the structure with known, intentional 
values?

Thank you for any illumination provided.

Gary

  reply	other threads:[~2016-05-20 15:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18 12:06 IV generation in cryptographic driver in AEAD Denis B
2016-05-18 13:56 ` Catalin Vasile
2016-05-18 14:21   ` Denis B
2016-05-19  2:43     ` Herbert Xu
2016-05-19  6:44     ` Catalin Vasile
2016-05-19 11:05       ` Denis B
2016-05-20  4:19         ` Herbert Xu
2016-05-20 15:50           ` Gary R Hook [this message]
2016-05-20 23:31             ` Herbert Xu
2016-05-23 13:27               ` Gary R Hook
2016-05-18 17:58 ` Stephan Mueller

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=573F324E.7000100@amd.com \
    --to=ghook@amd.com \
    --cc=begun.denis@gmail.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 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).