From nobody Mon Apr 29 04:22:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1579216894; cv=none; d=zohomail.com; s=zohoarc; b=UpRjTfMgK0By4GaMbxvr/qylhYsxFOAr8PpDA+MBcEtsUJ5P4SUITDHJAT+8/iReTERIVoWnlfKn3kM2LCIt/5EphbLds4JhTOuaQ35rC2rqMih+708cHJYZ27k1n2nXMfHvm12IciGcQKwr1hWGlOSAbP5lwg8mU+eUjugjCWY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579216894; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/Jxac41ScZ9wklqoaoJ1ujuvSIgK3pa8BvU4q8iE/qg=; b=HyG2331wgTs1myBKXisIrLSaEwjoYb5quD+qXVeNjdHAq7avTwifD0pMuvKujO0zm1a6n80Bm60BQEVwhiCQj0p4UoDu9DVDIJT5iW7Cy83h20JSTcPvqsPOwH5eGk/jjQpErNc9AWXXkpOvSCLiJKA2/ncQbFF/Q/PaViNxgJA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579216894962611.1187790030386; Thu, 16 Jan 2020 15:21:34 -0800 (PST) Received: from localhost ([::1]:49716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isESC-0004t6-SJ for importer@patchew.org; Thu, 16 Jan 2020 18:21:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51396) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isEFV-0002fa-IK for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1isEFU-000834-2y for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:25 -0500 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:54154) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1isEFT-00081v-SC for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:24 -0500 Received: by mail-pj1-x1043.google.com with SMTP id n96so2277576pjc.3 for ; Thu, 16 Jan 2020 15:08:20 -0800 (PST) Received: from cloudburst.ASUS (rrcs-66-91-136-155.west.biz.rr.com. [66.91.136.155]) by smtp.gmail.com with ESMTPSA id s7sm5111578pjk.22.2020.01.16.15.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 15:08:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/Jxac41ScZ9wklqoaoJ1ujuvSIgK3pa8BvU4q8iE/qg=; b=DHbB57ykUvSpDmrZzJBQzelX/Q4mRPA0rkl9wlyr6Dbbn5Swd19bcjKOcquJO5bwMi EWZi4us5RfWM3PNg4C5hgS8l2j9x2LESi0HfNVIIDpzfaiqbEpGL+U6rCwH8DZ8LZhhZ VCkvemRaQd93b80ZS/f31nSZdwYb3OULptLLd4Zy/UEzNuc9/3olXCAsAT/Ghy3Y1+ek vjEcSxFYnbqRCMuTNMsQRUlL/vL4QDnGpsDJVN6G2tX4G6aVofuwWy4oVjq2Ev8exb5W yhyVXUdWLidb55BEf28JV/XMXYcp6YlufYxCWI6Gm9Y7aBpanha0hRxHgaa4gdmsKY48 ieCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/Jxac41ScZ9wklqoaoJ1ujuvSIgK3pa8BvU4q8iE/qg=; b=VPdo7bmUsFQutVKVE+ZjFH7gTX9jal81i7dMmJexyCMy9lTY/gjORarYOBxHtXhGd7 LaNH3yNZCWQdFcqACon9GE7tjoXbu7iLVqFYKLNpvBC4l89VMJrvwWcppJ2aP3Cug46i PA14GiKYIrWn8dZlt6eGJ9qlomdNbUfPbyTku6qimut3yjME/Oo4u6i9YNSSpRncXAdG om89lLb57HbJKJCa3yBEIIql4hs+chqK2lxMzYYqHOtFkpd1TvtMbUdCzQYMML9ixPO9 zXOmLMea+jWxBOSd+5qnJ5gWGYRPAHM+sJskoi/UzpDHoT9l5L9N2cSNtFg8HvZxWfO7 O39g== X-Gm-Message-State: APjAAAVQ6k4I29/CGyXKsJngaIC6X53u6Z99Bw92SeYVju+6tUQa/4yw IIIpgSHvAE4g99q9YLkB/SxQ04AUX5c= X-Google-Smtp-Source: APXvYqxenawD/zo7RWmeGAEuzpcNrQDUOQTMILLR2z+Zg/h+GrnMY0AumNfnwgJahG6Kt1f6i8aIcw== X-Received: by 2002:a17:90a:950b:: with SMTP id t11mr1987656pjo.79.1579216099560; Thu, 16 Jan 2020 15:08:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 1/4] target/arm: Fix PAuth sbox functions Date: Thu, 16 Jan 2020 13:08:06 -1000 Message-Id: <20200116230809.19078-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116230809.19078-1-richard.henderson@linaro.org> References: <20200116230809.19078-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1043 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, vincent.dehors@smile.fr, alex.bennee@linaro.org, adrien.grassein@smile.fr Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Vincent Dehors In the PAC computation, sbox was applied over wrong bits. As this is a 4-bit sbox, bit index should be incremented by 4 instead of 16. Test vector from QARMA paper (https://eprint.iacr.org/2016/444.pdf) was used to verify one computation of the pauth_computepac() function which uses sbox2. Launchpad: https://bugs.launchpad.net/bugs/1859713 Reviewed-by: Richard Henderson Signed-off-by: Vincent DEHORS Signed-off-by: Adrien GRASSEIN --- target/arm/pauth_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c index d3194f2043..0a5f41e10c 100644 --- a/target/arm/pauth_helper.c +++ b/target/arm/pauth_helper.c @@ -89,7 +89,7 @@ static uint64_t pac_sub(uint64_t i) uint64_t o =3D 0; int b; =20 - for (b =3D 0; b < 64; b +=3D 16) { + for (b =3D 0; b < 64; b +=3D 4) { o |=3D (uint64_t)sub[(i >> b) & 0xf] << b; } return o; @@ -104,7 +104,7 @@ static uint64_t pac_inv_sub(uint64_t i) uint64_t o =3D 0; int b; =20 - for (b =3D 0; b < 64; b +=3D 16) { + for (b =3D 0; b < 64; b +=3D 4) { o |=3D (uint64_t)inv_sub[(i >> b) & 0xf] << b; } return o; --=20 2.20.1 From nobody Mon Apr 29 04:22:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1579216271; cv=none; d=zohomail.com; s=zohoarc; b=JkbDJY+vRKSbLQSoSHAJHq0kMZL2qnLZpXD/x/HsJhNwKKJg92B/1fF/VLlm+lzQmspUpx3svVv/8YyBRAdnXtAGjgYhw7Vd0wPel8B3H89AfRPGrQYMv/DPBqtaT6l1nMivPglHXuDJJTdajnhEGtMGkZqdKqb++tXAqy5rqBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579216271; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NVbq1Jag2Ekov4ET8qNdfiaIvA8EZAKN4xv0TeisvTw=; b=LEtFkLRUHpBMj/s0xuEeOHgJBP9tM2GxyVnI4dUWe1fZukiYBFxi3SO0pXgdPv6n4pWF1FijLoEQteaZUoAUeBMovJ7J/FlMHshtGBQ4MMzWI0AetwIxosKYmJsFQqes4N4L79a6AiwiV9ZKAGqfoPr6yhFdv0XgKAjKx8GSHt0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579216271035934.0218657569843; Thu, 16 Jan 2020 15:11:11 -0800 (PST) Received: from localhost ([::1]:49622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isEI9-0005mK-Q1 for importer@patchew.org; Thu, 16 Jan 2020 18:11:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51442) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isEFb-0002lf-1g for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1isEFa-00086c-19 for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:30 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:37208) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1isEFZ-00082W-Rm for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:29 -0500 Received: by mail-pl1-x644.google.com with SMTP id c23so9018679plz.4 for ; Thu, 16 Jan 2020 15:08:22 -0800 (PST) Received: from cloudburst.ASUS (rrcs-66-91-136-155.west.biz.rr.com. [66.91.136.155]) by smtp.gmail.com with ESMTPSA id s7sm5111578pjk.22.2020.01.16.15.08.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 15:08:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NVbq1Jag2Ekov4ET8qNdfiaIvA8EZAKN4xv0TeisvTw=; b=zsizWUveFCD+JR7XI8QiMaGtfBljiK39Fy4uai3KKQ5ijeft74PT/v0THXRAA+ow+W 75MlADDz3qG5mc5VMeziRgrsGXCkX/NFo74Ra+xBUWUkDkBeEcs32pfzAikXabRDpuD5 DII0IMMHQ7Q1fZzF/SMmgD4+TSuGH9NE20g+vEN4lixsfs4gOS2fan87XylRPK90eeyR MLtuUt5sZbYcXWFzH3XWJfC31hHJoCGYRAURIEEw7fscpllTvAVy8RclV76Dmw7VIjLr 44Y5Rot6hrGnjEWg1S5x1m2NGXYoj6RSizvEKyfXCsRcZ+GcLfzpxzQb6GcO/S5AtalS 9n0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NVbq1Jag2Ekov4ET8qNdfiaIvA8EZAKN4xv0TeisvTw=; b=gDtokNNKTwDvTGAVCPZXr6QhWwlqiDH8ncdF+4sVdr6qShp8Y45AwSr9eJ+rIL8p9L djoibDwWxSFceARHLUoCpWrGJjSFuE3SX2mU3MDZy6BP/UUKs6y/y3CPjNe20jv7pztP ninsRS3YFRk8oNdJMwujiW9dLQCs0GbZLtcfsQumwgI3CACg7+kaQ1vziDc2MEcegD6O xefByvUY/NDrleKlPXGpfmHXm1X4TkofMht0cZjCCvZ1ugMzLCLuyT08/TQBfVeynVkv XOiHHeRASEwo6pBIxY5Gq6m+1+7Cj4CpZwgdXjdx2RNgpf4CDUowbu5kQLvOgdSdZTht 0vwQ== X-Gm-Message-State: APjAAAXzHPUb3aMYMMbbYzxRtEnceVWFRsbPYYE8CBuYA+yLasXrbYc4 U1PmTMvvmarhR0fHw3iuyFVuxv9XqeU= X-Google-Smtp-Source: APXvYqzs5na07qLW5vghc3yt+NlTJJxnxj3J6IP4MxGdEP+NtR2U5HRPDU0A0da9Z27/35M4b7Gnug== X-Received: by 2002:a17:90b:2289:: with SMTP id kx9mr2058984pjb.94.1579216101221; Thu, 16 Jan 2020 15:08:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/4] tests/tcg/aarch64: Fix compilation parameters for pauth-% Date: Thu, 16 Jan 2020 13:08:07 -1000 Message-Id: <20200116230809.19078-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116230809.19078-1-richard.henderson@linaro.org> References: <20200116230809.19078-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, vincent.dehors@smile.fr, alex.bennee@linaro.org, adrien.grassein@smile.fr Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Hiding the required architecture within asm() is not correct. Add it to the cflags of the (cross-) compiler. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/tcg/aarch64/pauth-1.c | 2 -- tests/tcg/aarch64/pauth-2.c | 2 -- tests/tcg/aarch64/Makefile.target | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/tcg/aarch64/pauth-1.c b/tests/tcg/aarch64/pauth-1.c index a3c1443cd0..ea0984ea82 100644 --- a/tests/tcg/aarch64/pauth-1.c +++ b/tests/tcg/aarch64/pauth-1.c @@ -2,8 +2,6 @@ #include #include =20 -asm(".arch armv8.4-a"); - #ifndef PR_PAC_RESET_KEYS #define PR_PAC_RESET_KEYS 54 #define PR_PAC_APDAKEY (1 << 2) diff --git a/tests/tcg/aarch64/pauth-2.c b/tests/tcg/aarch64/pauth-2.c index 2fe030ba3d..9bba0beb63 100644 --- a/tests/tcg/aarch64/pauth-2.c +++ b/tests/tcg/aarch64/pauth-2.c @@ -1,8 +1,6 @@ #include #include =20 -asm(".arch armv8.4-a"); - void do_test(uint64_t value) { uint64_t salt1, salt2; diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index df3fe8032c..374c8d6830 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -20,6 +20,7 @@ run-fcvt: fcvt # Pauth Tests AARCH64_TESTS +=3D pauth-1 pauth-2 run-pauth-%: QEMU_OPTS +=3D -cpu max +pauth-%: CFLAGS +=3D -march=3Darmv8.3-a =20 # Semihosting smoke test for linux-user AARCH64_TESTS +=3D semihosting --=20 2.20.1 From nobody Mon Apr 29 04:22:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1579216176; cv=none; d=zohomail.com; s=zohoarc; b=WcJAAwzwwvowdZeL9Tb4I66Xbc4ECJc3iRaHOCxNqkwyq3kzEm5yEe70MGUGdX0NNUfKyjV3dI+/9cDYXpYIINkakef02IaB9Kl4DWn5t4ofUhw+Cvj8bUveeQDWWqturomXPq7LHVHzmAndLv2k699tQP1mNAsTY4Edl5Cmrz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579216176; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=stg+e2AWftdtGimCGELoLi5XJTSvE6Z/YM/75Jku7WI=; b=I0tSGFizV3YMOt36lNn0Dfiw5vX/mPb3wJ2YKIrtEBdsBuGPpcrM8w0veV8L0LdGAxHlrrE0BSWQe4rstzGVEr9mgPUX11bO2nnvNzEPmx7GNNsCwny/PVkDnTUAnnrkcDgxiLn4FycPTmObRQtLK5danFFC4Lz9G8wK51IdSTI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579216176415600.0798750276281; Thu, 16 Jan 2020 15:09:36 -0800 (PST) Received: from localhost ([::1]:49590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isEGd-0003bf-5K for importer@patchew.org; Thu, 16 Jan 2020 18:09:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51405) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isEFV-0002fi-Uo for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1isEFU-00083V-JX for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:25 -0500 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:38482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1isEFU-000830-E8 for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:24 -0500 Received: by mail-pj1-x1044.google.com with SMTP id l35so2386452pje.3 for ; Thu, 16 Jan 2020 15:08:24 -0800 (PST) Received: from cloudburst.ASUS (rrcs-66-91-136-155.west.biz.rr.com. [66.91.136.155]) by smtp.gmail.com with ESMTPSA id s7sm5111578pjk.22.2020.01.16.15.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 15:08:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=stg+e2AWftdtGimCGELoLi5XJTSvE6Z/YM/75Jku7WI=; b=D0oqySV8LJ8grKcCh5HHIZ2ipDkwodX3bQlK0laaOctxQ5U6BqQZZfzXITL5mrT5j1 ASlEjCj2DoEt0Lu7mEyZZDidGEglfh13jp7Lz+1qf225Js5Y9R3ALB1/1ltt5YQNXoQB N8dUvS+IE55tpw0oU9A5qr2hCKu1QrSyTIEyb/gEdW+zSMCIJzkssmWqm89tZmInJuw8 5GUSj5o9Zx4PK6B47VYrZw0cqQvXHjnarD/vsXpYfegdCmux+D4p0zn+uPJDBFZJ/EU4 ViDct44a411BXPH/N5On/yMuwTK6k6xhkEx18FfJ/kuRKN6y42ji448RBvwLD7ARnTV3 D2dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=stg+e2AWftdtGimCGELoLi5XJTSvE6Z/YM/75Jku7WI=; b=NXfdL/LTGRJchHHQDKW48wWa8nI+towV2DZaulWuEsR0W+F+Xwok6/sctGohrYsPXD MyJsvDD3PsujmQ/XivYtj0BGSeYT2mvqyZ6NLOdB3p56F8aY9Susbkym3tiLDGvoFHcO ZdmNEkwYmI2pofVN+YV7PyP/mKsMrlHWDuRA8b59nqYPApSNVNvsEiYaiV737GB6Nx3q 11hDkSVSkyvIgcMi6+cAvzJWC/OBBX2RPCGTef1qxnP9D1jAMOS2ThVrtIwDiTblXP7P Eoy6Dkb0Wmkp03R9Ojp5pX5PDQQxS8CMEWfE+ytuA50L1Nad/qM1fYBy6xbEHAGpI2zW X0pQ== X-Gm-Message-State: APjAAAXgCkGbSxsdd8JG3+O/rWtDxnSLAkYS716UXiyjj9qLKRAo/h8M LSMHEAAE3EEgOWYGBlitWAgl7wYovNQ= X-Google-Smtp-Source: APXvYqwzbTV0eZ0wMahPSoFM7fxp8Iq9TwQet1uF7AvOKQTxheDl7XpaRv/NbcA4RFXQWx6V/UL1/A== X-Received: by 2002:a17:90b:258:: with SMTP id fz24mr2002106pjb.6.1579216103138; Thu, 16 Jan 2020 15:08:23 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 3/4] tests/tcg/aarch64: Add pauth-3 Date: Thu, 16 Jan 2020 13:08:08 -1000 Message-Id: <20200116230809.19078-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116230809.19078-1-richard.henderson@linaro.org> References: <20200116230809.19078-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1044 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, vincent.dehors@smile.fr, alex.bennee@linaro.org, adrien.grassein@smile.fr Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This is the test vector from the QARMA paper, run through PACGA. Suggested-by: Vincent Dehors Signed-off-by: Richard Henderson --- tests/tcg/aarch64/system/pauth-3.c | 40 +++++++++++++++++++++++ tests/tcg/aarch64/Makefile.softmmu-target | 5 ++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/system/pauth-3.c diff --git a/tests/tcg/aarch64/system/pauth-3.c b/tests/tcg/aarch64/system/= pauth-3.c new file mode 100644 index 0000000000..42eff4d5ea --- /dev/null +++ b/tests/tcg/aarch64/system/pauth-3.c @@ -0,0 +1,40 @@ +#include +#include + +int main() +{ + /* + * Test vector from QARMA paper (https://eprint.iacr.org/2016/444.pdf) + * to verify one computation of the pauth_computepac() function, + * which uses sbox2. + * + * Use PACGA, because it returns the most bits from ComputePAC. + * We still only get the most significant 32-bits of the result. + */ + + static const uint64_t d[5] =3D { + 0xfb623599da6e8127ull, + 0x477d469dec0b8762ull, + 0x84be85ce9804e94bull, + 0xec2802d4e0a488e9ull, + 0xc003b93999b33765ull & 0xffffffff00000000ull + }; + uint64_t r; + + asm("msr apgakeyhi_el1, %[w0]\n\t" + "msr apgakeylo_el1, %[k0]\n\t" + "pacga %[r], %[P], %[T]" + : [r] "=3Dr"(r) + : [P] "r" (d[0]), + [T] "r" (d[1]), + [w0] "r" (d[2]), + [k0] "r" (d[3])); + + if (r =3D=3D d[4]) { + ml_printf("OK\n"); + return 0; + } else { + ml_printf("FAIL: %lx !=3D %lx\n", r, d[4]); + return 1; + } +} diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/= Makefile.softmmu-target index 7b4eede3f0..f6b5121f5c 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -61,4 +61,7 @@ run-memory-replay: memory-replay run-memory-record $(QEMU_OPTS) memory, \ "$< on $(TARGET_NAME)") =20 -EXTRA_TESTS+=3Dmemory-record memory-replay +run-pauth-3: pauth-3 +pauth-3: CFLAGS +=3D -march=3Darmv8.3-a + +EXTRA_TESTS+=3Dmemory-record memory-replay pauth-3 --=20 2.20.1 From nobody Mon Apr 29 04:22:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1579216276; cv=none; d=zohomail.com; s=zohoarc; b=b3NFd8S3Mk0cbmo8d1qX7SeKrqdy5bZuDL+46JhTuOycjj8m1zAFpuiYpI+cVoAbSdxwtyiitTXJW9V+bYaTbNYJvyMBrmbl7AzpwoyjLpieF8STKKQMOEqNRlr1SFt6C6pG+lHWXT2AfjUkIBHXFN4f6oJcS4lZP56tD4V2IIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579216276; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Tr0oxdmAfzE1nW8KiWlCJDKgMy/qK0eB4ARHFT7qrQI=; b=HXU4EyWLk4Q1x0Cfx7oDGgrkBEe+r8qNeyruSTUZafX2nUvpX5872YUDJDhVKNJBDOwA80sU0KpuU5gNNTFWZIK8vk41J8ZfOV47YQsb8nL6SedArVtbOZQbJVQuvVEj34x/wMsH2TBIFvQgMPecUSvC1dlqmfZ1FCmQeIRBwLk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579216276327752.624390330971; Thu, 16 Jan 2020 15:11:16 -0800 (PST) Received: from localhost ([::1]:49626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isEIF-0005va-6g for importer@patchew.org; Thu, 16 Jan 2020 18:11:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51429) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isEFZ-0002ix-Dd for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1isEFY-00085Y-BM for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:29 -0500 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:45625) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1isEFY-00085G-6L for qemu-devel@nongnu.org; Thu, 16 Jan 2020 18:08:28 -0500 Received: by mail-pg1-x535.google.com with SMTP id b9so10655000pgk.12 for ; Thu, 16 Jan 2020 15:08:28 -0800 (PST) Received: from cloudburst.ASUS (rrcs-66-91-136-155.west.biz.rr.com. [66.91.136.155]) by smtp.gmail.com with ESMTPSA id s7sm5111578pjk.22.2020.01.16.15.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 15:08:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Tr0oxdmAfzE1nW8KiWlCJDKgMy/qK0eB4ARHFT7qrQI=; b=PXBXpD555MuimMsvzvUvu/yFuV61mYbPW7BErCgkYo3m1v/dm2qfjmbOxxUKK2z48f umWOyCx0NQDytwBwcHui2OUCkTv9ojUpDu7YuxVcd0IdRkcs0tkNtYfUM0ZQMXawBUBq 9ctitZkvBBfvAkAH3GpJAyS94ObiaGfq/HyknG8kpX+j56Ae78Ud3wExDo6ziVEV35hu lawwzkcRsVqObrQJk/4kUpVDf7fFfbWyLZzG8DeaIrUzE1D+/HNhC99CKkrTXElU8eBC ALUWY5O4sFNSx9dCTVnkoJ9JGllHXioA90+7oIzYwgE0DcPocV8FfKjy/O3L0BEU3hoW GxSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Tr0oxdmAfzE1nW8KiWlCJDKgMy/qK0eB4ARHFT7qrQI=; b=hDjr6cfOgJoBI+ymzNp/DgXDX2ZMyhAoNfAfALwGApKkztraePxp0vFAh9JG24jW2c yAK5Aq0TqTU+gXpLH3tnid9ltJAcpbVUbRYC4zwxX+xNd+2+x9BHtIH3Wn5rUeKGbr6w 3sDp1yupoYmvumivOhC652zNEEAwuWIFMQ8aXLE428j4Aaezhaxv2S3EPCQZDQQxAGos PpIVKlw5zUJ3mfz2JR93mFXsX5Hfx1ZKA52r5iO5DddoGMZAe0f2g/g2JIwI73jgbJYa OhBYQM9H/+4MRToMb16ArD/XI+qtMSN0i+XGirvCbFE5LtiwwaLBsnXujpUN28T6YHB4 gEHA== X-Gm-Message-State: APjAAAWMhEHsWyCUtH4+GHcpHSqJwEpvnh6bE2AxGe1rUWVnPiHqXJKW zrb+jVuBf+CEF9OQibaEMvk2aoGx6Wo= X-Google-Smtp-Source: APXvYqyOiXAOqTSky9MAEDwVv2DNq+yVeywQx46rb51Rq45g6S9fOYx3D/pDtzN4qU/saIvfpBWgtA== X-Received: by 2002:a63:5964:: with SMTP id j36mr42477266pgm.225.1579216106685; Thu, 16 Jan 2020 15:08:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 4/4] tests/tcg/aarch64: Add pauth-4 Date: Thu, 16 Jan 2020 13:08:09 -1000 Message-Id: <20200116230809.19078-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116230809.19078-1-richard.henderson@linaro.org> References: <20200116230809.19078-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::535 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, vincent.dehors@smile.fr, alex.bennee@linaro.org, adrien.grassein@smile.fr Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Perform the set of operations and test described in LP 1859713. Suggested-by: Adrien GRASSEIN Signed-off-by: Richard Henderson --- tests/tcg/aarch64/pauth-4.c | 25 +++++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/pauth-4.c diff --git a/tests/tcg/aarch64/pauth-4.c b/tests/tcg/aarch64/pauth-4.c new file mode 100644 index 0000000000..4b22e6e282 --- /dev/null +++ b/tests/tcg/aarch64/pauth-4.c @@ -0,0 +1,25 @@ +#include +#include + +int main() +{ + uintptr_t x, y; + + asm("mov %0, lr\n\t" + "pacia %0, sp\n\t" /* sigill if pauth not supported */ + "eor %0, %0, #4\n\t" /* corrupt single bit */ + "mov %1, %0\n\t" + "autia %1, sp\n\t" /* validate corrupted pointer */ + "xpaci %0\n\t" /* strip pac from corrupted pointer */ + : "=3Dr"(x), "=3Dr"(y)); + + /* + * Once stripped, the corrupted pointer is of the form 0x0000...wxyz. + * We expect the autia to indicate failure, producing a pointer of the + * form 0x000e....wxyz. Use xpaci and !=3D for the test, rather than + * extracting explicit bits from the top, because the location of the + * error code "e" depends on the configuration of virtual memory. + */ + assert(x !=3D y); + return 0; +} diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index 374c8d6830..efa67cf1e9 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -18,7 +18,7 @@ run-fcvt: fcvt $(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref) =20 # Pauth Tests -AARCH64_TESTS +=3D pauth-1 pauth-2 +AARCH64_TESTS +=3D pauth-1 pauth-2 pauth-4 run-pauth-%: QEMU_OPTS +=3D -cpu max pauth-%: CFLAGS +=3D -march=3Darmv8.3-a =20 --=20 2.20.1