Re: [PATCH v4 3/3] crypto: aesgcm - Provide minimal library implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 25 Oct 2022 at 07:32, Eric Biggers <ebiggers@xxxxxxxxxx> wrote:
>
> 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?
>

I'll add a comment in the code where the counter increment occurs.

Using int is easier because I can use signed comparison with 0 to
decide whether we are done. We don't need the range so unless someone
feels using unsigned int is essential here, I am going to leave it as
is.


> > +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.
>

I'll change that.



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux