From patchwork Sun Jul 9 18:29:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 700891 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp4828965wrs; Sun, 9 Jul 2023 11:38:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlHu/LJDO3JWuR0+Es4AD3Zc9rvblmTb4EDbQ5xf7UwYYRgRUoXGw5vRMpOmuRwe0vsgKnrD X-Received: by 2002:a05:622a:92:b0:403:9dbf:62d1 with SMTP id o18-20020a05622a009200b004039dbf62d1mr7887957qtw.31.1688927892888; Sun, 09 Jul 2023 11:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688927892; cv=none; d=google.com; s=arc-20160816; b=Z/CNrI8CFdcOs+LSCIbOz5z3tsSo5KVKMwMV45X4GYwVVYUxzdaJeFHlQcYqcdPx84 YhNezZcaqRfou9bFmKoe+sT2s1k+0RZMioy43r1yvzr2Bu50UvIjk2nOpMJ0LojvMfGe aBKKGyxJU1jPb2mHp8kTzGCTbFmPhh1eFkUXC8hS7UMe7U01PZ+cCglXwjZByH497q9h FfE+AorbBMCzKaPMqIwte0A+dsWUfH8rGCQSjKNaFJ4zEA6SQ5f4BGT3zuN1DCtN0eoB m4TomMRmgnTIXrbESyZJGLT4x0JVEkshh/S1BGrYP10qhAnIRZuZUUAiCzCSPcXIThRn d6vg== 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=ehiRk+/4K4ZdSH5tBEmArhhxk2Xw8P4NzuIBcv7dVgQ=; fh=3IEiF/YPZ00TE94rna3Orj/L+TRFhpuNf7ElRJz3ubE=; b=vNn3tzD1+arUQTvCMQa72XhckbcdAwlGa0aOt6n+xNk/P7J4zoGPO1YXNNMvbvsDVf tfjR/3RPo1t8WlZR0x8MLEDofTUUhd02cps7UWlsm8pfL5zmXHVmcJLv/vIKtFPmnUhW 40G7iq3MJuES9ZidXvTBsv1+pFFUl+IVUPsrAGbCnD0JixnQy6TDtgd26TSmUqQ2Prte o70tM1SKLEGg4c1N0ZLU/3mMf27rGnTTXgeZ89/XDkjqN+zMzEXtj2p9QW60vfcijEOJ QNJjQhP4781QvBABVpVgMLs4QqkymXNNBB6yrVxWquh/66mTIUrEQhT9pakWYPRag/vP wpHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ts7b6gID; 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 12-20020ac8570c000000b003fde9320602si4620405qtw.492.2023.07.09.11.38.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jul 2023 11:38:12 -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=ts7b6gID; 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 1qIZEC-0004wI-Rr; Sun, 09 Jul 2023 14:33:48 -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 1qIZDy-0003Ze-F9 for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:35 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIZDx-0004Ge-0G for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:34 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbea147034so37230395e9.0 for ; Sun, 09 Jul 2023 11:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927611; x=1691519611; 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=ehiRk+/4K4ZdSH5tBEmArhhxk2Xw8P4NzuIBcv7dVgQ=; b=ts7b6gID2uM1UB8wm54G4iRs2Wgna6SgDMVYW/LMvOZzFo1eAWQ5nZRPDBolohZQQv 01vAYnIiWKteCL7xvKWw/mwK2SXwzhh3rrDXHBEj3O3yMC3yqYmh9So5m9TR2hmz/RlA kKbRu7dCiCCgJcqgwHlygvlGQGoaQ1sRppYC8GI14238uLEcBDH03gmHFVfqI3HA7jOB Vq9zcMJj9rASvfsFXM118QBPlghqvZyHKP0Iz7X+/j9TbEL9Umzi0iydErQQdu6nGuxw /3ERoCQPAcEkWYJ93jVES0aiPFwNXgpJQYkuLondspvwA5Gd06u4D9QxeKF/Qqa5/rb/ ML4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927611; x=1691519611; 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=ehiRk+/4K4ZdSH5tBEmArhhxk2Xw8P4NzuIBcv7dVgQ=; b=j1iTINeAL0pqJ1ytJpVZm3RfxMEfqRDRuJCjUnKP/SlognoR1nNEabMHXH2pb6yNi+ Wtly6+VZXsSVCW2BSnSWM6AtmJIKg+ECRBZ4nRFGl+pDw4oYEf+585ZY0YDTb+MiYyeT US5j9yd04rG1UsELnP6MQqk7uFgBUXtoLdA1c7fTjR6IqInLK1uO0q4pYQbh25gByguB G3ilxJVY4eU6X3jzH+gNkakkbh66GQwTWfsiH0hs+8ejcUBOzLa33fK7zDT3IoB6KOKL XQpgCyhiv3xmX+IcRfINt8mjRZrELsTOgB6Puyvc/ISMueb4J4fICd8fFEYqgPMGf2h+ fV+w== X-Gm-Message-State: ABy/qLZ3vqHxEK5ZFW4xeq3pNhtykWhptWL9RoKOjYp+K2Bwv3ph1MKt mAAdC8ukBu8qNkZf9DtMPO57KLWZ6jC9X+ts1LO4Pw== X-Received: by 2002:a05:600c:294c:b0:3fb:ffef:d058 with SMTP id n12-20020a05600c294c00b003fbffefd058mr5897516wmd.0.1688927611071; Sun, 09 Jul 2023 11:33:31 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 32/37] target/riscv: Use aesenc_SB_SR_MC_AK Date: Sun, 9 Jul 2023 19:29:16 +0100 Message-Id: <20230709182934.309468-65-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230709182934.309468-1-richard.henderson@linaro.org> References: <20230709182934.309468-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32c.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, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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 AES64ESM instruction. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/riscv/crypto_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/riscv/crypto_helper.c b/target/riscv/crypto_helper.c index 505166ce5a..c036fe8632 100644 --- a/target/riscv/crypto_helper.c +++ b/target/riscv/crypto_helper.c @@ -198,7 +198,12 @@ static inline target_ulong aes64_operation(target_ulong rs1, target_ulong rs2, target_ulong HELPER(aes64esm)(target_ulong rs1, target_ulong rs2) { - return aes64_operation(rs1, rs2, true, true); + AESState t; + + t.d[HOST_BIG_ENDIAN] = rs1; + t.d[!HOST_BIG_ENDIAN] = rs2; + aesenc_SB_SR_MC_AK(&t, &t, &aes_zero, false); + return t.d[HOST_BIG_ENDIAN]; } target_ulong HELPER(aes64es)(target_ulong rs1, target_ulong rs2)