Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1128951iob; Wed, 4 May 2022 15:28:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzq2tEVcoG3zbpUAccoezC1jvScDIFMRezsmR+1k79L9b+c+kG9cDhqUQjvxOOLnaEY9ayL X-Received: by 2002:a05:6402:d05:b0:425:b7ab:776e with SMTP id eb5-20020a0564020d0500b00425b7ab776emr26141583edb.142.1651703313898; Wed, 04 May 2022 15:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651703313; cv=none; d=google.com; s=arc-20160816; b=cfek4KX+99OqPr5eZ/g3VnB6d/O99TTLgfIwQgjMfmh2qXEGxuHX7bLkxO2Evq8r4j faPc36DFKwsbiHM6bBrkoJpOT9pDTaev/SVVrrcXIvEPWc8atHxQ21KBBgs6e3MPcwPh qMhYu5Whw3uYyTCsoxhE1BzUh3kmapU/UpstgewetVT3qg+43P5IZtECOX0hP+9vmnfc jXQq2Ngii8tu2KaOPBWzuPhytyS2a8u3oAuBfViPuNsc7zVK5VjF0QEV7tIPzpQ5W4Vk ePAHeUSugDYgCjZXuQ7MRwFhTK//vIp+Gwv9woOsBoicmXEa4/40E/UDtQGp+w2CUN1M R8Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=O0/hKmkvb5BoU0+UFK3i+vBfCGj7h/+eV5+6M1+ExZM=; b=NzbVYxSszSi94tlsmlLdHOkO/qhAm9HqpGX60lv/gbZ4X9jCW8+ifgZseJvv+4BVsw IXtieLkDUuaXSe2CiFvFw7O1+jSVgFvWYUWlomYxna5HD3hYAQu2jWkQFm5qPLYYCNhr 5OVp2A1fzY2RgAxNQHUXbcyO+C4OZg4028YdBAo/zNUlwgUV04ebBofUdR30s3xPsxos YZ68ubnTxkPhGD5Iyj5QPNkYGq30rjf/4955BOaerNM7EcFLbSiicFj3HOvsbC4ZS8ZN +e71Jo9u0wU1G7uZo/rUVejJH5U51dhIFDehjXuV3lX6lZ+UQRST347Gdb4nkMUMQUIK uLRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=OzBXWUbj; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020a17090676d600b006e01f1d9677si144364ejn.532.2022.05.04.15.27.55; Wed, 04 May 2022 15:28:33 -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=@linux-foundation.org header.s=google header.b=OzBXWUbj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356198AbiEDUOB (ORCPT + 99 others); Wed, 4 May 2022 16:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345790AbiEDUOA (ORCPT ); Wed, 4 May 2022 16:14:00 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C9F12737 for ; Wed, 4 May 2022 13:10:23 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id v4so3061637ljd.10 for ; Wed, 04 May 2022 13:10:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=O0/hKmkvb5BoU0+UFK3i+vBfCGj7h/+eV5+6M1+ExZM=; b=OzBXWUbjQ+080MWC14jdCnBvwXL5uDnkzacs7MfgTd/OEo/P0xDEmgLRYvFfLeTaQx JCb2df+pPiKnY5JtAeaEC8UDsr9bOvUNWpODCHqcjIQi993kY6I7kPmVvju01wuAsTcG +NgW70KB4OMXFfc8QJi6r5l0fzPSUGCZdartU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O0/hKmkvb5BoU0+UFK3i+vBfCGj7h/+eV5+6M1+ExZM=; b=wwYEd2Qf9qb1Zv3o9W2Y6LShZXm0FAWx62NyVJLD2ugIwiS4MrpOg0lFqQRFizy6se Tn1wa1vgtjCV3UMwuqJjD+4QOJL5QftnJniy8i0sdyWsInj9K6IwjgfzAKiK9th0utbz 674c7hGa2deB+GZIrOGM0kVrYqbeUd3DDENXnlccxyhx4quxar9SoTuzaM8iaL+G0+aq lP5cHJwycbb1Dgk7QSWVvY2xmjT8WEzmVBFrIWeBIlvQ5hjlQhC8X8uOxFKZcCjFlrBe E0uHaeQaB0lS3ilB3vjhDOlZ1C5JN1aF5QLLAsMDzZdG4V9nts/K8tL5lWeRjXQOwQlR 8Nng== X-Gm-Message-State: AOAM532uyM3vLQlo1R1mgsSJujJez16M3KmD/YFKTL47HUd31CeS0sOP kllLJu/bra66zAe18PHISgzUzu5vPWBjMpNrWUc= X-Received: by 2002:a2e:b8c2:0:b0:250:61c6:8398 with SMTP id s2-20020a2eb8c2000000b0025061c68398mr7162728ljp.378.1651695021410; Wed, 04 May 2022 13:10:21 -0700 (PDT) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com. [209.85.208.172]) by smtp.gmail.com with ESMTPSA id k8-20020a2eb748000000b0024f3d1dae91sm1762995ljo.25.2022.05.04.13.10.20 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 May 2022 13:10:20 -0700 (PDT) Received: by mail-lj1-f172.google.com with SMTP id s27so3088899ljd.2 for ; Wed, 04 May 2022 13:10:20 -0700 (PDT) X-Received: by 2002:a2e:914d:0:b0:24f:6374:3eba with SMTP id q13-20020a2e914d000000b0024f63743ebamr10017408ljg.506.1651695019712; Wed, 04 May 2022 13:10:19 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Wed, 4 May 2022 13:10:03 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] hex2bin: make the function hex_to_bin constant-time To: Stafford Horne Cc: "Jason A. Donenfeld" , Andy Shevchenko , Mikulas Patocka , Andy Shevchenko , device-mapper development , Linux Kernel Mailing List , Linux Crypto Mailing List , Herbert Xu , "David S. Miller" , Mike Snitzer , Mimi Zohar , Milan Broz Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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, May 4, 2022 at 12:58 PM Stafford Horne wrote: > > I have uploaded a diff I created here: > https://gist.github.com/54334556f2907104cd12374872a0597c > > It shows the same output. In hex_to_bin itself it seems to only be a difference due to some register allocation (r19 and r3 switched around). But then it gets inlined into hex2bin and there changes there seem to be about instruction and basic block scheduling, so it's a lot harder to see what's going on. And a lot of constant changes, which honestly look just like code code moved around by 16 bytes and offsets changed due to that. So I doubt it's hex_to_bin() that is causing problems, I think it's purely code movement. Which explains why adding a nop or a fake printk fixes things. Some alignment assumption that got broken? Linus