From patchwork Sun Jul 9 18:29:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 700903 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp4829389wrs; Sun, 9 Jul 2023 11:39:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlHtWNWa5AyRqq/VKwawElH9CloHJ/Oc5IMdMCbqSIp6xFs0sPgEZvGES8d4FxNVumki28Al X-Received: by 2002:ac8:7d0a:0:b0:403:279f:33e with SMTP id g10-20020ac87d0a000000b00403279f033emr12523179qtb.17.1688927993524; Sun, 09 Jul 2023 11:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688927993; cv=none; d=google.com; s=arc-20160816; b=AhPyNJeIRHGUdrjjdclZ/WMUBOvMwnmVRnDhVa1SWx2gg5AR22grEQ9zpi1mOeT8DW Zj9u/R2u0ik9UjsfB3H815e6OWPl0fgX84iERN9q3mW8+8vz38gkQ1Nf5fbxqSelvqOA JPQqsloWWwDcbKRN2ZcepxE/QN+GUsSrkPWytWJjXm490mxp7rmC3byGyRzy+5ZSfJ7S iEos0k9Cz6pofSA7pC5u50uJfQ5IFizjpt0/9EQTjh9FmjwlOTOAWsRxFqfrA4Okva4e UKecxSk1iR1ycyEr8KPkQFF93cn52glmf0vecsGAFfzkrEIETmqCyTwdNHBg+XZSB0AF j+Hg== 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=3IEiF/YPZ00TE94rna3Orj/L+TRFhpuNf7ElRJz3ubE=; b=FxElUDMWfoNF7p4+hd8jg0XTxs8lZ6jv8wVY13uUW/kySPK9pCR4cU4IECqJON9C7u WSCmYTFPE/OQOw4DSBexW0htiQ52SohwmzSUEjMB9XjgaLuGwFeyChy0ZYe64QQj9oJj lwVvCWGQSipKtGdMIAAJ6OOp21FM4x1utGrLg5/IZl6mixDiTynzze4EbZ1H+prrtOl0 dnvjQXTQWI/oi/9i/tutBypG+NsaDn7VqiURH2JVjyAmfTZ8oJ+nxvNidaEqAT81i/AO wFzjYadabnZjwpsrorQxcaqUsbmW+VAadF2kMhm9zvOrRof6l93+8quvvPEinViBJFO8 pEMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bC7HqoJU; 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 l12-20020a05622a050c00b003f683dbaaeasi4985858qtx.341.2023.07.09.11.39.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jul 2023 11:39:53 -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=bC7HqoJU; 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 1qIZE8-0004Ls-J6; Sun, 09 Jul 2023 14:33:44 -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 1qIZDs-0003WP-EI for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:33 -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 1qIZDp-0004Dv-1X for qemu-devel@nongnu.org; Sun, 09 Jul 2023 14:33:27 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fbdfda88f4so37720685e9.1 for ; Sun, 09 Jul 2023 11:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688927603; x=1691519603; 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=bC7HqoJUdK/9jTD+nPvdkdjxFlWyq7W3M3OKwNVoT1egDBw1IvPhgHPcZiXgMoTZEl yFptIoshhgvv11Z8HHJyPI2tDkFJuD2Ysg+6qi1CJAtpPOcdU04bBvJs9yIWDqHlXeGz Aiyx7vu1PCCSYvjDkEuPpTEvjJt7H4bftFt66BXwCWRTIlLggrmEV2/PJL1R+LziExuM dSF04n+dhTJ5uwvhJ/qUAvq1X7BPgbk/xIMkp4Q0adDck+1YkTyJWLyyicaLpfFy9yWd h2h0St7E6cSi8TYRyPngw8mtb9NFLN2yxXHknWvRsl7nUvV3+IjfJoTAjGjzytQ3W1C+ uauA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688927603; x=1691519603; 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=YQtF7yt6px6G27VGovtK3GlHOrUcCHMQNuW75/q5PhClcFxxzjz0EiW4WT+DDuT1q8 PNL45OvageuAfn6lsUcHiy4PlCxbpuRrB64hvQkQKtAPDzLcNyo5mi4gkRzv1jDsx9xG zpiUlWFE0d23B3J+XF5Jo1ajy7nAX3Ue/hCgWV1gPx08oMHy9odPO1ChJ9/hA9NvOXTu BVn+wo11/AH6qDCiBCUeROVO/2wu9g43aN0VDserSQckehFAsXl9OAenk3iCBeigslbo fR9dca6aBJyiZTjJ5fx6waev21bWrZQh54uhLA9qSnIiDOqXeTcmTky1Eq23K2Spub63 MX8w== X-Gm-Message-State: ABy/qLZ6YkNgRRjEoI6f67hF4Q5qY5oDO/g/gzNwMpUw1+UKV8ZBk9/i c9YPV9ZYMM8aFsxP8DkObeJRThAV2sBvLtQGHOL/ag== X-Received: by 2002:a7b:cd96:0:b0:3fc:443:3773 with SMTP id y22-20020a7bcd96000000b003fc04433773mr4435572wmj.30.1688927603172; Sun, 09 Jul 2023 11:33:23 -0700 (PDT) Received: from stoup.. ([148.252.133.210]) by smtp.gmail.com with ESMTPSA id e17-20020a5d4e91000000b0031433760a92sm9635256wru.115.2023.07.09.11.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 11:33:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: laurent@vivier.eu, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 27/37] target/arm: Use aesenc_MC Date: Sun, 9 Jul 2023 19:29:06 +0100 Message-Id: <20230709182934.309468-55-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 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)); }