From patchwork Sun Jul 9 13:59:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 700842 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp4742497wrs; Sun, 9 Jul 2023 07:05:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlG/UfZExG2u6V3zYEbBH0ATpwzCQSkHgFHMQke1IpgF8EzpxbI4GqAe7d+GsK8u/lGj1tp7 X-Received: by 2002:a0c:b399:0:b0:62b:49e1:4946 with SMTP id t25-20020a0cb399000000b0062b49e14946mr8254827qve.21.1688911513358; Sun, 09 Jul 2023 07:05:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688911513; cv=none; d=google.com; s=arc-20160816; b=wfXf0PfRuVVw0lHqVRc9slg1mWAkUeX/ihYzKTzRmAQjHcET0hdO14eMWfHTqw6AH0 XTyOok3NxPW2SMIURD8Dcv8RaCCmjB2iZ5JCoezlMqXbzaQr1LZmHFc7PxNmUUjx6YKm wKNc1/wliCFRVF6JJyAAVyMWlazcRcSpHfBADFJDu21HQM9yTBNYhAfdCuE4aezPhyEC 7hw3Ajwk3hxycY5JTWIAutQdfq4rF3FMtC2eTDrHQqd2lZTy7UeycgM6eGEMVA79SjTY BW2uK7HR/sEMTEJq5hW4rP2sGjKOu0UP5gjTFmTPdE61fnIi1NhGlhoeqlseYhTMI5j3 EHnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8HOx1ZLKzsBUTcaboEy/mBqeLFtnDXaBWlHTAqwIG7M=; fh=i1mkeM7bD/ppus3C3v+92ltBBCUUU0zBXrpbYjAjHqE=; b=QiXEXUreJCCxHaEMm91e2O+AZBIsiHL0sz9+soo3Ba4Wunh8C5ylMHm0ODdmfcxo8O uonnno84KvYyP0VHvSm+5tKoCAyCA1mGlc9CX7KYm0sNibO4VfpWGormncIM2mjWnI9u A8QGqK4dqQ0dJgByks5LO7zLlTdeDk/97877JFfXr3XOKJjrSCZf8SOa2oqbMsvtypaq rbExbFNv5G4SRKYkEeXc27Uv6qKKafUbu0HJRrvJwxHBnI78esvT82sg7pJ9Y32SE4T7 6vzYmBwDGkwNC/69UlZBdpCQ9CSOr+wnls7i+fKQSG+IxXsGp2GgkMo2ll4hxn4Xy4i4 fUnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q6pgoeLN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y9-20020a0ce049000000b00635dbf100a6si4743352qvk.126.2023.07.09.07.05.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jul 2023 07:05:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q6pgoeLN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIUxg-0000Xx-KI; Sun, 09 Jul 2023 10:00:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIUxW-0000T5-EJ for qemu-devel@nongnu.org; Sun, 09 Jul 2023 10:00:18 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIUxQ-0000dl-Bz for qemu-devel@nongnu.org; Sun, 09 Jul 2023 10:00:18 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fbc77e76abso37949465e9.1 for ; Sun, 09 Jul 2023 07:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688911211; x=1691503211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8HOx1ZLKzsBUTcaboEy/mBqeLFtnDXaBWlHTAqwIG7M=; b=q6pgoeLNe2MpDLDUL8FnIdFIT/TMSQlxkBLvAbt6dVm/abqqf5RwCKSpMl+k0vTRCO WkFzzp+Nn0BgtdL7peqfGiIE9ef8DSCVA/x9L53Fnq70kNP3SnrUqtpf/A/GtFMUp1v0 T6ChgfLCRA2MsJ0wWYYXRu5jBgV9x/p0cmpydTmLZCEdLdKhvgzpyo3OUV/QZGQ972fE xrE/ivEMUUFIvk1tpvYK8e4zpX6UsuMciElemUIRZBNwRnhKwRn2ygx4JdR+vXuMa4an xWre+qsb8VynQrEBzkvOgkGg0LCj1THRCNdqiOCePXsL4xB98Jj4+Vubsb1S5LDTPgS5 a1EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688911211; x=1691503211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8HOx1ZLKzsBUTcaboEy/mBqeLFtnDXaBWlHTAqwIG7M=; b=ho/J80NVJPQsa7Db5Sl74z6JqgfkCR3DekI0d4caQCFRkkXzJtQjhdwNa17TS4UOf1 ReReSAO658yt4ntF9LXWCpjdTFaGj1lSNFf0kupyG0Ycb1GgZOYI3u5Bjw1i4K72jPYu 0upLG++/o4hyRJWFS9tZIf0r94ttiylPqfpr6PlHmF9E4gfrm0CVk7M56QmJlGxleBTc Fnd+quN6hC9cMm1oIR9uMI3GZjYFtUtRztb5v6cukBtKhjLIMY90/rBBT+8iSTnAhy7P ThavEhSILIv6KIHHJzMNFGebeVyC/p72SV4FZ9q7i7s5hibDTu9gvPS3VQeQE6jj7Tz6 C+uw== X-Gm-Message-State: ABy/qLY5kTuaaTXRJaDQJqQqVHbJahjLF+7Xxq9oWMNXK5/9/q1NOrr0 V3fUPh7RvvKi0ya1ObxjOklJOW1ftUGsMTKKGleYyQ== X-Received: by 2002:a05:600c:29a:b0:3fb:abd0:2b52 with SMTP id 26-20020a05600c029a00b003fbabd02b52mr8285896wmk.13.1688911210816; Sun, 09 Jul 2023 07:00:10 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id v18-20020a5d6792000000b003063a92bbf5sm9239422wru.70.2023.07.09.07.00.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 07:00:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 27/37] target/arm: Use aesenc_MC Date: Sun, 9 Jul 2023 14:59:35 +0100 Message-Id: <20230709135945.250311-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709135945.250311-1-richard.henderson@linaro.org> References: <20230709135945.250311-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This implements the AESMC instruction. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/crypto_helper.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/target/arm/tcg/crypto_helper.c b/target/arm/tcg/crypto_helper.c index d2cb74e7fc..1952aaac58 100644 --- a/target/arm/tcg/crypto_helper.c +++ b/target/arm/tcg/crypto_helper.c @@ -124,7 +124,20 @@ void HELPER(crypto_aesmc)(void *vd, void *vm, uint32_t desc) intptr_t i, opr_sz = simd_oprsz(desc); for (i = 0; i < opr_sz; i += 16) { - do_crypto_aesmc(vd + i, vm + i, AES_mc_rot); + AESState *ad = (AESState *)(vd + i); + AESState *st = (AESState *)(vm + i); + AESState t; + + /* Our uint64_t are in the wrong order for big-endian. */ + if (HOST_BIG_ENDIAN) { + t.d[0] = st->d[1]; + t.d[1] = st->d[0]; + aesenc_MC(&t, &t, false); + ad->d[0] = t.d[1]; + ad->d[1] = t.d[0]; + } else { + aesenc_MC(ad, st, false); + } } clear_tail(vd, opr_sz, simd_maxsz(desc)); }