Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp702569iob; Wed, 4 May 2022 06:23:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNQjrBjZa7WJFsXWOLYMiwlt4FQOlAOm65Jkwrb1zwi8n+4PncWSFrZyZPIiqbFxnrU07T X-Received: by 2002:a17:907:161f:b0:6f4:378a:c2d8 with SMTP id hb31-20020a170907161f00b006f4378ac2d8mr16168351ejc.289.1651670607180; Wed, 04 May 2022 06:23:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651670607; cv=none; d=google.com; s=arc-20160816; b=xoc2KpzViHqmzun3Wqm6cewI+4qXRtrIumbVDweg4XgbBfPja9c80v9zTfoOUCVTig GS2wIRmSwWOIQ/Nu6Zge6Wsmk9beoP9ehXo1jQ+l+iLSC7SmZ1O3+TuUAIL3sRNdGbAs p+/5QclFOKLqbFgN3s+IWJ5k+hV+WNZR1f2YdLqoUFuQH89mXdNX93ZDGzTiM0fwxWHt fip69cl/iwuLAzGsMVpNnBPzEJdqhCzgpVT962i8QRfD44TDklqvVDra7Bsvz0ILB+N6 SCNTJ7WxEj+jehqGMbhNC8kKNlGwRGsYuQ9UPD8UrchaVlguIjmqhGxpxh/S8sz9awMU 8xjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=fvXq2I6YdSSqQfmfOGxLM58nh3ANCa3aK4uOGFmwSCU=; b=tY+qAcEfdkWGl1ESiuf2p5rnUymm3HQ1fTsnUf9w+Nt4TxcjJLY7S4co5wGtYO4eJm GwJv/d0MX/RJkyqjAmg47DW7Yl1g8LNJvuyLUAa5wX61HSrhc6+9W20OV0rjtszj1IdF VaLPKZ11dR2dyQMhOib/UqI5IvyKNn6zdrGYbbeIK0ZTeqD6s/suJEOMkBp1ei2//sx4 1dvwhGrKf0nfQ3lX8SEm1EYZ1ApzHuUjoCFpx6CdvU+zXkPesENpSk/cEv+4xLmdjPf6 HVMWxh0wd2/Yikyqm15miOvFBaQaQ82kJcFzcJ23ADAAkKtdDNYDt52LhvFnUF/cG+pQ y0XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=holUDCOA; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jt5-20020a170906dfc500b006dfe7ec38f4si16234773ejc.770.2022.05.04.06.22.28; Wed, 04 May 2022 06:23:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=holUDCOA; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346881AbiEDJCH (ORCPT + 99 others); Wed, 4 May 2022 05:02:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347219AbiEDJCA (ORCPT ); Wed, 4 May 2022 05:02:00 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B761225298 for ; Wed, 4 May 2022 01:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651654661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fvXq2I6YdSSqQfmfOGxLM58nh3ANCa3aK4uOGFmwSCU=; b=holUDCOAfKFsn3LNkle9Cj2MB/qb5+kJU9WTHX+ZBIj4Vc4YSOl+GOZgbtJvtcgx7yauJl kdKKel2jqGe8g1AM24ueOiFJ1Pcnu6dKBvvLdPR76QbibJ+8+v+dXgKkU1w7LObRyRUY2t DcQ/Rtz4puSaHOYJj9dLhsALYrGJzac= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-542-6GjmA59aOUmzLHgsh8KXYA-1; Wed, 04 May 2022 04:57:38 -0400 X-MC-Unique: 6GjmA59aOUmzLHgsh8KXYA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 705533C02B61; Wed, 4 May 2022 08:57:37 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6EB0B4010E21; Wed, 4 May 2022 08:57:36 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 2448va6o023376; Wed, 4 May 2022 04:57:36 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 2448vZ0c023372; Wed, 4 May 2022 04:57:35 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 4 May 2022 04:57:35 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Stafford Horne cc: Linus Torvalds , Andy Shevchenko , device-mapper development , Linux Kernel Mailing List , Linux Crypto Mailing List , Herbert Xu , "David S. Miller" , Mike Snitzer , Mimi Zohar , Milan Broz , Jason@zx2c4.com Subject: Re: [PATCH v2] hex2bin: make the function hex_to_bin constant-time In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, 4 May 2022, Stafford Horne wrote: > On Mon, Apr 25, 2022 at 08:07:48AM -0400, Mikulas Patocka wrote: > > > From: Mikulas Patocka > > > > -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