From patchwork Fri Jun 9 02:23:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 690857 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp597995wru; Thu, 8 Jun 2023 19:26:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Z6eNRRXpWauHsNKaEyuJLLyXORujCYrcrsJnbRnsWQKTwuE4xRPJbicQMTTkCDJFZ2+6W X-Received: by 2002:a05:620a:24ca:b0:75b:23a1:830a with SMTP id m10-20020a05620a24ca00b0075b23a1830amr10202579qkn.5.1686277593532; Thu, 08 Jun 2023 19:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686277593; cv=none; d=google.com; s=arc-20160816; b=Bq5DkwYrPgyZNNDT0xH1lg6oup2oa4DhAjp1MjPhhgCjUVkoMfxhHsKe9Z1ZEWx3Mn Z4O5/KDNGm9k1aJdyRUhCdhDiZLNJZFaCd+ahvlOTHFg2CKsnkx3s/uM8d1ox3lmKq8F VWg0xzIWBRFne3Esh4yM53Z2C6SQ0vY90hiS3HwfslMphjh+Za4xFnX43epJGuqj6jHg MY/pbCYFhzZYodR88xrbjmM0ZFJx0MfPjMDs0uBh/bqQ86/tI5sUvAH2WkkRzuSCcdLa kIcjAEZUh514bv+kWNapN6NpjTs8Qq1wI2Qic9vtbJxBonNLZryCQHzFi94uqCxf6bnt FLXQ== 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=N6iXZSXnCLQtjnIuP74mgzpVObleAywaFeG7GQpsIEc=; b=e0myb/0skbGDZ9cKzJ+gbPxJF3ZavlvT6aOcPl94eRDXY3Y5g3ULrmI7kBwtoEn87K zIbdnRHdwNUI2dynrJK82vzJ4jP5ue/090glt64VkCp3P8g+lK65BOa4fETF0Vmj4b+t S8c+IM4HSGnBM68j7paCKDI2H+d6AEr4E04peKA7cMMM70uT09TlG1/I7HnCTwljj7Aq TmtwrGDTK/FJsSYTza8Iri28muVlbOuucGZdTDmlbeiWf2E3WodK1UgrEP2sZcKGU8zg fklsNRCauJP0ktM2lZQiCg/hFw2oCzlulUKufokbEBTcz0ArLtAhIyxVHsDQ+XiYvkuO wwWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PvuSVdUs; 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 o11-20020ae9f50b000000b0075ce3d37b63si1526569qkg.554.2023.06.08.19.26.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Jun 2023 19:26:33 -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=PvuSVdUs; 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 1q7Rp2-0004OW-L7; Thu, 08 Jun 2023 22:25:52 -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 1q7Rnv-0002sf-8y for qemu-devel@nongnu.org; Thu, 08 Jun 2023 22:24:44 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q7RnZ-0005gX-3P for qemu-devel@nongnu.org; Thu, 08 Jun 2023 22:24:42 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-65055aa4ed7so1049794b3a.3 for ; Thu, 08 Jun 2023 19:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686277460; x=1688869460; 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=N6iXZSXnCLQtjnIuP74mgzpVObleAywaFeG7GQpsIEc=; b=PvuSVdUsFfVgUkl74+RoDIvV8K+LDpzvs4YM1zaTYLNZ5B7I6oMGsgUxJHN1OKimbv Nu2wohnKhG51RoYO7q/g5zqwqIHATnG/RSjbD5+LZsmQlxrbFuh5VMZoGmURo8WyyRV5 E693Cj3Auj/dmPjwdWJPFxAloxXHRGKKG9mLRTltvTv/a9WFhnQLy5zTwCTjDlwbK/aZ dielY5p8Oi+YA9kQi1gir/E3ssJ4iaQowgtGmvaBfKlrSbcGMu1zOKtNKjeMNdQ3KVwq AUjBUZqDuHlhAbJlsQdUVKSflIq/xt7rHHUjh/rcdUwqCIbtGGul9KwUSW7aKGvSCxCs rITA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686277460; x=1688869460; 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=N6iXZSXnCLQtjnIuP74mgzpVObleAywaFeG7GQpsIEc=; b=MC7EGdmZDc7GVQwh32HI2kF9fs8V8jAGgXjMSrU/xTlRMfvk4TPf0v8pG7oX+W2tWc tbwZpfLpMKKcPIuH+FcUu39wPuNtPVFFaHmiLgCPLX5L0UewwOXIfowelzuGZImkushf P480CnMhSJlDo7QVKRtqkAyLLGSLqv2KgRMxwQ2bPMsMXx2U6uI3MVAKPyvS13ltmiyG mAva+zUcIrViI81oqKYhrP0KFqz7J12Ka8Cw68IbCtxl9oaVD9KgfLtEG0wMEBXBJHnj KOX/W4qu1ErZ9Tb/OPIKZcNycp56NQKyB6nWxz0hGWzB1xi9fkN01+YAw/IKvb5C+dys lu3g== X-Gm-Message-State: AC+VfDyYOeOG2oPsMAARBobdXwtWibwMdWUPdg5OL9BTIBzz5YaO5m7L kuRZCPNhnbYL0vg9HehSKQBNVO3DPHeuRSBGn5E= X-Received: by 2002:a05:6a00:228e:b0:64d:41d5:d160 with SMTP id f14-20020a056a00228e00b0064d41d5d160mr3122pfe.20.1686277459775; Thu, 08 Jun 2023 19:24:19 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:b071:df63:5761:f449]) by smtp.gmail.com with ESMTPSA id x25-20020a62fb19000000b0063afb08afeesm1686458pfm.67.2023.06.08.19.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 19:24:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: ardb@kernel.org, berrange@redhat.com, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, pbonzini@redhat.com Subject: [PATCH v2 18/38] target/arm: Use aesenc_MC Date: Thu, 8 Jun 2023 19:23:41 -0700 Message-Id: <20230609022401.684157-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230609022401.684157-1-richard.henderson@linaro.org> References: <20230609022401.684157-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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. 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)); }