[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.02.2205040453050.22937@file01.intranet.prod.int.rdu2.redhat.com>
Date: Wed, 4 May 2022 04:57:35 -0400 (EDT)
From: Mikulas Patocka <mpatocka@...hat.com>
To: Stafford Horne <shorne@...il.com>
cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Shevchenko <andy@...nel.org>,
device-mapper development <dm-devel@...hat.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Mike Snitzer <msnitzer@...hat.com>,
Mimi Zohar <zohar@...ux.ibm.com>,
Milan Broz <gmazyland@...il.com>, Jason@...c4.com
Subject: Re: [PATCH v2] hex2bin: make the function hex_to_bin constant-time
On Wed, 4 May 2022, Stafford Horne wrote:
> On Mon, Apr 25, 2022 at 08:07:48AM -0400, Mikulas Patocka wrote:
>
> > From: Mikulas Patocka <mpatocka@...hat.com>
> >
> > -int hex_to_bin(char ch)
> > +int hex_to_bin(unsigned char ch)
> > {
> > - if ((ch >= '0') && (ch <= '9'))
> > - return ch - '0';
> > - ch = tolower(ch);
> > - if ((ch >= 'a') && (ch <= 'f'))
> > - return ch - 'a' + 10;
> > - return -1;
> > + unsigned char cu = ch & 0xdf;
> > + return -1 +
> > + ((ch - '0' + 1) & (unsigned)((ch - '9' - 1) & ('0' - 1 - ch)) >> 8) +
> > + ((cu - 'A' + 11) & (unsigned)((cu - 'F' - 1) & ('A' - 1 - cu)) >> 8);
> > }
> > EXPORT_SYMBOL(hex_to_bin);
>
> Hello,
>
> Just a heads up it seems this patch is causing some instability with crypto self
> tests on OpenRISC when using a PREEMPT kernel (no SMP).
>
> This was reported by Jason A. Donenfeld as it came up in wireguard testing.
>
> I am trying to figure out if this is an OpenRISC PREEMPT issue or something
> else.
Hi
That patch is so simple that I can't imagine how could it break the
curve25519 test. Are you sure that you bisected it correctly?
Mikulas
Powered by blists - more mailing lists