qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: David Hildenbrand <david@redhat.com>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
	Thomas Huth <thuth@redhat.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Cornelia Huck <cohuck@redhat.com>,
	Harald Freudenberger <freude@linux.ibm.com>,
	Holger Dengler <dengler@linux.ibm.com>
Subject: Re: [PATCH v8 1/2] target/s390x: support SHA-512 extensions
Date: Thu, 22 Sep 2022 16:35:48 +0200	[thread overview]
Message-ID: <YyxyxCZH4X5n7Rdy@zx2c4.com> (raw)
In-Reply-To: <793e6018-da21-2247-1348-ad0e62030e25@redhat.com>

On Thu, Sep 22, 2022 at 03:07:13PM +0200, David Hildenbrand wrote:
> +        if (processed >= MAX_BLOCKS_PER_RUN * 128) {
> +            break;

If you make this a `goto out` or similar instead of a break, then you
can

> +    if (type == S390_FEAT_TYPE_KLMD && len < 128) {

change that to `if (len)`.

> +        /*
> +         * Pad the remainder with zero and place magic value 128 after the
> +         * message.
> +         */
> +        memset(x + len, 0, 128 - len);
> +        x[len] = 128;

"magic value 128" ==> "set the top bit"

Aside from these nits, this refactoring looks fine. I haven't tested
this or checked the crypto carefully, but if it passes all the Linux
test vectors, hopefully things are still fine.

Jason


  reply	other threads:[~2022-09-22 15:49 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 10:07 [PATCH v8 1/2] target/s390x: support SHA-512 extensions Jason A. Donenfeld
2022-09-21 10:07 ` [PATCH v8 2/2] target/s390x: support PRNO_TRNG instruction Jason A. Donenfeld
2022-09-22 13:09   ` David Hildenbrand
2022-09-22 15:40   ` Thomas Huth
2022-09-26 15:11   ` Thomas Huth
2022-09-26 15:19     ` Jason A. Donenfeld
2022-09-22 13:07 ` [PATCH v8 1/2] target/s390x: support SHA-512 extensions David Hildenbrand
2022-09-22 14:35   ` Jason A. Donenfeld [this message]
2022-09-22 14:51     ` David Hildenbrand
2022-09-22 15:11       ` David Hildenbrand
2022-09-22 15:36       ` Thomas Huth
2022-09-22 15:37         ` David Hildenbrand
2022-09-23 10:14   ` Alex Bennée
2022-09-22 15:38 ` [PATCH v8.1 " David Hildenbrand
2022-09-22 15:55   ` Thomas Huth
2022-09-22 16:35     ` Jason A. Donenfeld
2022-09-23  6:25       ` Thomas Huth
2022-09-22 17:18     ` David Hildenbrand
2022-09-23  6:23       ` Thomas Huth
2022-09-23  6:37         ` David Hildenbrand
2022-09-23  9:19           ` Jason A. Donenfeld
2022-09-23 10:47             ` David Hildenbrand
2022-09-23 11:19               ` Jason A. Donenfeld
2022-09-23 11:35                 ` David Hildenbrand
2022-09-23 11:46                   ` Jason A. Donenfeld
2022-09-23 12:05                     ` Thomas Huth
2022-09-23 12:07                       ` Jason A. Donenfeld
2022-09-23 12:45                         ` Thomas Huth
2022-09-23 12:13                     ` David Hildenbrand

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=YyxyxCZH4X5n7Rdy@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=dengler@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.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 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).