qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Dorjoy Chowdhury <dorjoychy111@gmail.com>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
	Alexander Graf <graf@amazon.com>
Subject: Re: possible bug in recent crypto patches in master branch
Date: Mon, 14 Oct 2024 11:28:42 +0100	[thread overview]
Message-ID: <ZwzyWpitEpwpYLfT@redhat.com> (raw)
In-Reply-To: <CAFfO_h4Byz-RNv+HjTnbmo0NWL_BA4JM_3c_7ecFWa0wE21Pkw@mail.gmail.com>

On Sun, Oct 13, 2024 at 10:32:36PM +0600, Dorjoy Chowdhury wrote:
> Hi,
> I think there maybe some bugs caused by the recent crypto patches that got
> merged to master. ref:
> https://lore.kernel.org/qemu-devel/CAFEAcA-e_1WFLun2HptTt2bSzXkSMBnxKAK_UzUhwRh_fb66Fg@mail.gmail.com/T/#t
> 
> I think before these patches the "qcrypto_hash_bytes" or
> "qcrypto_hash_bytesv" apis used to behave such that a user of the apis
> could pass his own allocated buffers. In that case, the passed buffers
> would be used to fill in the hash result instead of allocating a new
> buffer. But I think in the master branch now, these apis always allocate
> the result buffer regardless of it's users passing their own buffers or
> not. So this is problematic for wherever the users of the apis are passing
> their own allocated buffers. For example, I see target/i386/sev.c is one
> such api user. Am I missing something here or does this look like it's a
> clear bug?
> 
> If I am correct, I think it makes sense to keep the old behavior of the
> apis where new buffers are not allocated if the user supplies one (I think
> it probably also makes sense if we force the users to always provide the
> bufffer instead of the apis themselves allocating them). I noticed this bug
> in the nitro-enclave work I am doing where rebasing the branch builds but
> the actual behavior is buggy because of this new change of the api
> implementations.

Yes, you're right. The behaviour has changed.

Although the API docs suggested that the 'result' buffer was allocated
internally, they did not explicitly require that, and our impl did
lazy allocation.

I'll work on fixing this and adding test cases for it

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-13 16:32 possible bug in recent crypto patches in master branch Dorjoy Chowdhury
2024-10-14 10:28 ` Daniel P. Berrangé [this message]

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=ZwzyWpitEpwpYLfT@redhat.com \
    --to=berrange@redhat.com \
    --cc=dorjoychy111@gmail.com \
    --cc=graf@amazon.com \
    --cc=peter.maydell@linaro.org \
    --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).