qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dorjoy Chowdhury <dorjoychy111@gmail.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 1/2] crypto/hash: avoid overwriting user supplied result pointer
Date: Tue, 15 Oct 2024 20:13:00 +0600	[thread overview]
Message-ID: <CAFfO_h4fTspFTHJVHeoCz5TSBtS9HV5v6dr6sZMsrHQ_uodZ2A@mail.gmail.com> (raw)
In-Reply-To: <20241015125629.301367-2-berrange@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 991 bytes --]

On Tue, Oct 15, 2024 at 6:56 PM Daniel P. Berrangé <berrange@redhat.com>
wrote:

> If the user provides a pre-allocated buffer for the hash result,
> we must use that rather than re-allocating a new buffer.
>
> Reported-by: Dorjoy Chowdhury <dorjoychy111@gmail.com>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  crypto/hash-gcrypt.c | 15 ++++++++++++---
>  crypto/hash-glib.c   | 11 +++++++++--
>  crypto/hash-gnutls.c | 16 +++++++++++++---
>  crypto/hash-nettle.c | 14 +++++++++++---
>  4 files changed, 45 insertions(+), 11 deletions(-)
>

Thanks for fixing. These changes look good to me but it might make sense to
update the corresponding api documentation in include/crypto/hash.h to
explicitly mention that *result can be a user supplied buffer with proper
*result_len, if not, allocated inside the function itself. I see a few
places in that file that may be worth updating as part of this commit. What
do you think?

Regards,
Dorjoy

[-- Attachment #2: Type: text/html, Size: 1508 bytes --]

  reply	other threads:[~2024-10-15 14:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15 12:56 [PATCH 0/2] crypto: fix regression in hash result buffer handling Daniel P. Berrangé
2024-10-15 12:56 ` [PATCH 1/2] crypto/hash: avoid overwriting user supplied result pointer Daniel P. Berrangé
2024-10-15 14:13   ` Dorjoy Chowdhury [this message]
2024-10-15 12:56 ` [PATCH 2/2] tests: correctly validate result buffer in hash/hmac tests Daniel P. Berrangé

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=CAFfO_h4fTspFTHJVHeoCz5TSBtS9HV5v6dr6sZMsrHQ_uodZ2A@mail.gmail.com \
    --to=dorjoychy111@gmail.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.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).