From nobody Wed Feb 11 00:55:36 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1597289706; cv=none; d=zohomail.com; s=zohoarc; b=luYk9F4e4/DJf2vobUNof/3XYZkFve02yM2T1sPexU6nIlzv3oqOmqqPtTUxxjU9nDpUoMktiyAa9ojJ62bbVBziL0ym03y7ouprzFUi8nQGzVzFwLnBa49nvxNTY+gHWsGFnatWUoTisgKHl7TXzkEXjowvzoi+ugOpOMXkhYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597289706; 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=b5OUwYC1ijM0U3q76fWa5pbJW4qjaynWy6iI0RpDBZA=; b=ECYsN5PYuJPpYcD27AZSn0N0PtDeUz4IWlrAHrHc21bqpmXiQM5+EGSbdnFd+qTiugwbgF8vuzdctkPfMgOmWwMdZ4HCyA4rT+xi6PunIAtiKRF1vdjX+R1UGNpxLwcVLo9NJvzYFY+XNVrEBC6iTlHXbwpjOybLERIFcQP+3W8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1597289706905525.1098917450468; Wed, 12 Aug 2020 20:35:06 -0700 (PDT) Received: from localhost ([::1]:48598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k641B-0001De-MW for importer@patchew.org; Wed, 12 Aug 2020 23:35:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k63sG-0004wk-UD for qemu-devel@nongnu.org; Wed, 12 Aug 2020 23:25:52 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:41904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k63sF-00008K-1I for qemu-devel@nongnu.org; Wed, 12 Aug 2020 23:25:52 -0400 Received: by mail-pl1-x641.google.com with SMTP id f10so2006232plj.8 for ; Wed, 12 Aug 2020 20:25:50 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id m19sm3633164pgd.21.2020.08.12.20.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 20:25:48 -0700 (PDT) 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=b5OUwYC1ijM0U3q76fWa5pbJW4qjaynWy6iI0RpDBZA=; b=Z34Qg9RJYkEGdiY8XgVqi5Rc5YXJmKhvp33kAxFpafyAZJcer9i6qQqe5bkcdo1123 wmcEValt0eaYNOsBVIPqFDALa7qXq8tCmde4lsGeALatZ4PgBJy83EpjMuTqugHAzZs9 EyOE7fz5CzRPvpLAeADS/lnTqHYuQANFitytZxK2BCQMuQhy1UezCPrO6/zkXKEZkBiv 9VIsXEIlKKsgC4M6AaLZ2dbff7QgakTa0rPqoSSG94yh8nuzbLlrGGB8TJsPPP2HjngJ RovYJHOMWgweqgiTIABSk8EF7F+ufVXFLkkgNPSr9z+Xf1GpVlXE5aDfjD658YQh5JJR kfQg== 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=b5OUwYC1ijM0U3q76fWa5pbJW4qjaynWy6iI0RpDBZA=; b=RJspRT5JKqytaFqqLHVq3PNMTxLANOFDl3R9/nrSIOu1Eksn3YC2RankJcArtf/+S4 7G6Sc2QlUpqHqUoZu6kTyCxWC6vzfOlhHq1sYS82GnCO09afc+56Bpb9/dNcgz6eflRS J5cAOTo2B0n7Chqi+tOfkaV6Y4jwS3EXgg3s0jmhpLchFTPneECSIlbRU+LniIdl52so p6RFLekBTJuO2br6nUmlMgecUuKyshl/a+7UDwoUoJ5ZDBuK8NScRiaVLhmCilW9a7/0 thDRtjTaXyHXMqKdjSh9NY4lBBLQwsuZcyootM2RR4v9OLDZ3ZmoM04sc5q3foDYhl/V eCGw== X-Gm-Message-State: AOAM531CYB/xZeNPi3Igl1Dt1azq2i3Um1vSvloUG8u02i2Oxm2wfmiL 3LKRjwQAlc35sNo1XPjOMTOfu9cc1SA= X-Google-Smtp-Source: ABdhPJzuHGa0z3arZXNJig3fOWPpx3+RTFygPAJRvnWCWHs5P7lR0LvNILzq8WPOmnL127nbPkyhXw== X-Received: by 2002:a17:90b:784:: with SMTP id l4mr2813640pjz.96.1597289149308; Wed, 12 Aug 2020 20:25:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/17] crypto: Use the correct const type for driver Date: Wed, 12 Aug 2020 20:25:27 -0700 Message-Id: <20200813032537.2888593-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200813032537.2888593-1-richard.henderson@linaro.org> References: <20200813032537.2888593-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::641; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x641.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=ham autolearn_force=no X-Spam_action: no action 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: berrange@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" This allows the in memory structures to be read-only. Signed-off-by: Richard Henderson Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- crypto/cipherpriv.h | 2 +- include/crypto/cipher.h | 2 +- crypto/cipher-afalg.c | 2 +- crypto/cipher-builtin.inc.c | 2 +- crypto/cipher-gcrypt.inc.c | 2 +- crypto/cipher-nettle.inc.c | 2 +- crypto/cipher.c | 12 ++++++------ 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crypto/cipherpriv.h b/crypto/cipherpriv.h index 9228c9fc3a..b73be33bd2 100644 --- a/crypto/cipherpriv.h +++ b/crypto/cipherpriv.h @@ -47,7 +47,7 @@ qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg, const uint8_t *key, size_t nkey, Error **errp); =20 -extern struct QCryptoCipherDriver qcrypto_cipher_afalg_driver; +extern const struct QCryptoCipherDriver qcrypto_cipher_afalg_driver; =20 #endif =20 diff --git a/include/crypto/cipher.h b/include/crypto/cipher.h index 95a0412911..022a8d1157 100644 --- a/include/crypto/cipher.h +++ b/include/crypto/cipher.h @@ -78,7 +78,7 @@ struct QCryptoCipher { QCryptoCipherAlgorithm alg; QCryptoCipherMode mode; void *opaque; - void *driver; + const QCryptoCipherDriver *driver; }; =20 /** diff --git a/crypto/cipher-afalg.c b/crypto/cipher-afalg.c index cd72284690..5c7c44761b 100644 --- a/crypto/cipher-afalg.c +++ b/crypto/cipher-afalg.c @@ -218,7 +218,7 @@ static void qcrypto_afalg_comm_ctx_free(QCryptoCipher *= cipher) qcrypto_afalg_comm_free(cipher->opaque); } =20 -struct QCryptoCipherDriver qcrypto_cipher_afalg_driver =3D { +const struct QCryptoCipherDriver qcrypto_cipher_afalg_driver =3D { .cipher_encrypt =3D qcrypto_afalg_cipher_encrypt, .cipher_decrypt =3D qcrypto_afalg_cipher_decrypt, .cipher_setiv =3D qcrypto_afalg_cipher_setiv, diff --git a/crypto/cipher-builtin.inc.c b/crypto/cipher-builtin.inc.c index 56d45b0227..156f32f1c7 100644 --- a/crypto/cipher-builtin.inc.c +++ b/crypto/cipher-builtin.inc.c @@ -522,7 +522,7 @@ qcrypto_builtin_cipher_setiv(QCryptoCipher *cipher, } =20 =20 -static struct QCryptoCipherDriver qcrypto_cipher_lib_driver =3D { +static const struct QCryptoCipherDriver qcrypto_cipher_lib_driver =3D { .cipher_encrypt =3D qcrypto_builtin_cipher_encrypt, .cipher_decrypt =3D qcrypto_builtin_cipher_decrypt, .cipher_setiv =3D qcrypto_builtin_cipher_setiv, diff --git a/crypto/cipher-gcrypt.inc.c b/crypto/cipher-gcrypt.inc.c index a62839914b..18850fadb9 100644 --- a/crypto/cipher-gcrypt.inc.c +++ b/crypto/cipher-gcrypt.inc.c @@ -413,7 +413,7 @@ qcrypto_gcrypt_cipher_setiv(QCryptoCipher *cipher, } =20 =20 -static struct QCryptoCipherDriver qcrypto_cipher_lib_driver =3D { +static const struct QCryptoCipherDriver qcrypto_cipher_lib_driver =3D { .cipher_encrypt =3D qcrypto_gcrypt_cipher_encrypt, .cipher_decrypt =3D qcrypto_gcrypt_cipher_decrypt, .cipher_setiv =3D qcrypto_gcrypt_cipher_setiv, diff --git a/crypto/cipher-nettle.inc.c b/crypto/cipher-nettle.inc.c index 0404cfc6da..6ecce5e8ea 100644 --- a/crypto/cipher-nettle.inc.c +++ b/crypto/cipher-nettle.inc.c @@ -724,7 +724,7 @@ qcrypto_nettle_cipher_setiv(QCryptoCipher *cipher, } =20 =20 -static struct QCryptoCipherDriver qcrypto_cipher_lib_driver =3D { +static const struct QCryptoCipherDriver qcrypto_cipher_lib_driver =3D { .cipher_encrypt =3D qcrypto_nettle_cipher_encrypt, .cipher_decrypt =3D qcrypto_nettle_cipher_decrypt, .cipher_setiv =3D qcrypto_nettle_cipher_setiv, diff --git a/crypto/cipher.c b/crypto/cipher.c index deae82c264..d3ef856009 100644 --- a/crypto/cipher.c +++ b/crypto/cipher.c @@ -165,7 +165,7 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorith= m alg, { QCryptoCipher *cipher; void *ctx =3D NULL; - QCryptoCipherDriver *drv =3D NULL; + const QCryptoCipherDriver *drv =3D NULL; =20 #ifdef CONFIG_AF_ALG ctx =3D qcrypto_afalg_cipher_ctx_new(alg, mode, key, nkey, NULL); @@ -187,7 +187,7 @@ QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorith= m alg, cipher->alg =3D alg; cipher->mode =3D mode; cipher->opaque =3D ctx; - cipher->driver =3D (void *)drv; + cipher->driver =3D drv; =20 return cipher; } @@ -199,7 +199,7 @@ int qcrypto_cipher_encrypt(QCryptoCipher *cipher, size_t len, Error **errp) { - QCryptoCipherDriver *drv =3D cipher->driver; + const QCryptoCipherDriver *drv =3D cipher->driver; return drv->cipher_encrypt(cipher, in, out, len, errp); } =20 @@ -210,7 +210,7 @@ int qcrypto_cipher_decrypt(QCryptoCipher *cipher, size_t len, Error **errp) { - QCryptoCipherDriver *drv =3D cipher->driver; + const QCryptoCipherDriver *drv =3D cipher->driver; return drv->cipher_decrypt(cipher, in, out, len, errp); } =20 @@ -219,14 +219,14 @@ int qcrypto_cipher_setiv(QCryptoCipher *cipher, const uint8_t *iv, size_t niv, Error **errp) { - QCryptoCipherDriver *drv =3D cipher->driver; + const QCryptoCipherDriver *drv =3D cipher->driver; return drv->cipher_setiv(cipher, iv, niv, errp); } =20 =20 void qcrypto_cipher_free(QCryptoCipher *cipher) { - QCryptoCipherDriver *drv; + const QCryptoCipherDriver *drv; if (cipher) { drv =3D cipher->driver; drv->cipher_free(cipher); --=20 2.25.1