All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au,
	keescook@chromium.org, jason@zx2c4.com, nikunj@amd.com
Subject: Re: [PATCH v4 3/3] crypto: aesgcm - Provide minimal library implementation
Date: Mon, 24 Oct 2022 22:32:28 -0700	[thread overview]
Message-ID: <Y1d07G+jIeGron7E@sol.localdomain> (raw)
In-Reply-To: <20221024063052.109148-4-ardb@kernel.org>

On Mon, Oct 24, 2022 at 08:30:52AM +0200, Ard Biesheuvel wrote:
> The former concern is addressed trivially, given that the function call
> API uses 32-bit signed types for the input lengths. It is still up to
> the caller to avoid IV reuse in general, but this is not something we
> can police at the implementation level.

This doesn't seem to have been any note left about this in the code itself.
Sizes are usually size_t, so if another type is used intentionally, that should
be carefully documented.

Also, does it really need to be signed?

> +int __must_check aesgcm_decrypt(const struct aesgcm_ctx *ctx, u8 *dst,
> +				const u8 *src, int crypt_len, const u8 *assoc,
> +				int assoc_len, const u8 iv[GCM_AES_IV_SIZE],
> +				const u8 *authtag);

This returns 0 or -EBADMSG, which is inconsistent with
chacha20poly1305_decrypt() which returns a bool.  It would be nice if the
different algorithms would use consistent conventions.

-  Eric

  parent reply	other threads:[~2022-10-25  5:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24  6:30 [PATCH v4 0/3] crypto: Add AES-GCM implementation to lib/crypto Ard Biesheuvel
2022-10-24  6:30 ` [PATCH v4 1/3] crypto: move gf128mul library into lib/crypto Ard Biesheuvel
2022-10-25  5:26   ` Eric Biggers
2022-10-24  6:30 ` [PATCH v4 2/3] crypto: gf128mul - make gf128mul_lle time invariant Ard Biesheuvel
2022-10-24  6:30 ` [PATCH v4 3/3] crypto: aesgcm - Provide minimal library implementation Ard Biesheuvel
2022-10-24 16:21   ` Elliott, Robert (Servers)
2022-10-25  5:32   ` Eric Biggers [this message]
2022-10-25 12:48     ` Ard Biesheuvel

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=Y1d07G+jIeGron7E@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=jason@zx2c4.com \
    --cc=keescook@chromium.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=nikunj@amd.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 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.