From nobody Sun Nov 24 16:00:24 2024 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722327277; cv=none; d=zohomail.com; s=zohoarc; b=Aeol+oKB4W2IbtoOl8pOTJeMCUgNNp+IFYpivKnYnXv9KDUVkhG7zHApWUupfYX33m4HCfuHkJzS/uj0WHSVcfy8B9YAojF/LrlQlr0i7w4Sfq2kwdeyUw1B0ngv1TV27bw8c93nsp1bhW29b413W4nlJx0LpVjghz1aYlla+Kk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722327277; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l+Hr30f/nkeU+K1VaiSAh1pcOnN2fNBzvs8Aa9d3Qqg=; b=f/oSAl01OxOjmKpPCTjoC2H3Ne2SpUscv+3HVco3t8Y2qkB+QzSShEAdtrCd2uxVVmwfdgYl7EbqYDrhf5/Gv+GYWFU+9WruygJW0MqARrP7gNPl/oGCyDyEZiveTrbymrxfuE5yAepsHmwP8WPo/nSXWrXPQgHVJUVIxgJkPoE= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722327277252425.2760874089473; Tue, 30 Jul 2024 01:14:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sYhxv-0002kV-2A; Tue, 30 Jul 2024 04:12:15 -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 1sYhwx-0006Tb-Hf for qemu-devel@nongnu.org; Tue, 30 Jul 2024 04:11:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sYhwe-0001Kk-OD for qemu-devel@nongnu.org; Tue, 30 Jul 2024 04:11:15 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-257-N_J1yy1_OEOw2aAQ4wqXaw-1; Tue, 30 Jul 2024 04:10:51 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 47BCB1955BF9; Tue, 30 Jul 2024 08:10:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.65]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A63CC19560AE; Tue, 30 Jul 2024 08:10:44 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0A61B21F4B9A; Tue, 30 Jul 2024 10:10:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722327056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l+Hr30f/nkeU+K1VaiSAh1pcOnN2fNBzvs8Aa9d3Qqg=; b=DZinIuNGTDWIVJmh01KlQnJyZSjNKl1Arv9z29wFrGM0ePdj4w5N3okEHS5GSPkvef+vK3 pxiFIhSMM5D5Yt7d+je+T9BMG/68k2ZKjMhPEHLT80mTRBmHz4sNqtwBSHZAZeXUD2P/yu 9VgtiyrAdIWMTiAhzBUT2yzakyNTAhk= X-MC-Unique: N_J1yy1_OEOw2aAQ4wqXaw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com, andrew@codeconstruct.com.au, andrew@daynix.com, arei.gonglei@huawei.com, berrange@redhat.com, berto@igalia.com, borntraeger@linux.ibm.com, clg@kaod.org, david@redhat.com, den@openvz.org, eblake@redhat.com, eduardo@habkost.net, farman@linux.ibm.com, farosas@suse.de, hreitz@redhat.com, idryomov@gmail.com, iii@linux.ibm.com, jamin_lin@aspeedtech.com, jasowang@redhat.com, joel@jms.id.au, jsnow@redhat.com, kwolf@redhat.com, leetroy@gmail.com, marcandre.lureau@redhat.com, marcel.apfelbaum@gmail.com, michael.roth@amd.com, mst@redhat.com, mtosatti@redhat.com, nsg@linux.ibm.com, pasic@linux.ibm.com, pbonzini@redhat.com, peter.maydell@linaro.org, peterx@redhat.com, philmd@linaro.org, pizhenwei@bytedance.com, pl@dlhnet.de, richard.henderson@linaro.org, stefanha@redhat.com, steven_lee@aspeedtech.com, thuth@redhat.com, vsementsov@yandex-team.ru, wangyanan55@huawei.com, yuri.benditovich@daynix.com, zhao1.liu@intel.com, qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-s390x@nongnu.org, kvm@vger.kernel.org Subject: [PATCH 13/18] qapi/crypto: Rename QCryptoIVGenAlgorithm to *Algo, and drop prefix Date: Tue, 30 Jul 2024 10:10:27 +0200 Message-ID: <20240730081032.1246748-14-armbru@redhat.com> In-Reply-To: <20240730081032.1246748-1-armbru@redhat.com> References: <20240730081032.1246748-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.125, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722327279185116600 Content-Type: text/plain; charset="utf-8" QAPI's 'prefix' feature can make the connection between enumeration type and its constants less than obvious. It's best used with restraint. QCryptoIVGenAlgorithm has a 'prefix' that overrides the generated enumeration constants' prefix to QCRYPTO_IVGEN_ALG. We could simply drop 'prefix', but then the prefix becomes QCRYPTO_IV_GEN_ALGORITHM, which is rather long. We could additionally rename the type to QCryptoIVGenAlg, but I think the abbreviation "alg" is less than clear. Rename the type to QCryptoIVGenAlgo instead. The prefix becomes QCRYPTO_IV_GEN_ALGO. Signed-off-by: Markus Armbruster Acked-by: Daniel P. Berrang=C3=A9 --- qapi/crypto.json | 9 ++++----- crypto/ivgenpriv.h | 2 +- include/crypto/ivgen.h | 14 +++++++------- crypto/block-luks.c | 16 ++++++++-------- crypto/block-qcow.c | 2 +- crypto/ivgen.c | 10 +++++----- tests/unit/test-crypto-block.c | 14 +++++++------- tests/unit/test-crypto-ivgen.c | 22 +++++++++++----------- 8 files changed, 44 insertions(+), 45 deletions(-) diff --git a/qapi/crypto.json b/qapi/crypto.json index 6ab44fc018..996853cecf 100644 --- a/qapi/crypto.json +++ b/qapi/crypto.json @@ -122,7 +122,7 @@ 'data': ['ecb', 'cbc', 'xts', 'ctr']} =20 ## -# @QCryptoIVGenAlgorithm: +# @QCryptoIVGenAlgo: # # The supported algorithms for generating initialization vectors for # full disk encryption. The 'plain' generator should not be used for @@ -138,8 +138,7 @@ # # Since: 2.6 ## -{ 'enum': 'QCryptoIVGenAlgorithm', - 'prefix': 'QCRYPTO_IVGEN_ALG', +{ 'enum': 'QCryptoIVGenAlgo', 'data': ['plain', 'plain64', 'essiv']} =20 ## @@ -226,7 +225,7 @@ 'base': 'QCryptoBlockOptionsLUKS', 'data': { '*cipher-alg': 'QCryptoCipherAlgo', '*cipher-mode': 'QCryptoCipherMode', - '*ivgen-alg': 'QCryptoIVGenAlgorithm', + '*ivgen-alg': 'QCryptoIVGenAlgo', '*ivgen-hash-alg': 'QCryptoHashAlgo', '*hash-alg': 'QCryptoHashAlgo', '*iter-time': 'int' }} @@ -323,7 +322,7 @@ { 'struct': 'QCryptoBlockInfoLUKS', 'data': {'cipher-alg': 'QCryptoCipherAlgo', 'cipher-mode': 'QCryptoCipherMode', - 'ivgen-alg': 'QCryptoIVGenAlgorithm', + 'ivgen-alg': 'QCryptoIVGenAlgo', '*ivgen-hash-alg': 'QCryptoHashAlgo', 'hash-alg': 'QCryptoHashAlgo', 'detached-header': 'bool', diff --git a/crypto/ivgenpriv.h b/crypto/ivgenpriv.h index ef24c76345..e3388d30be 100644 --- a/crypto/ivgenpriv.h +++ b/crypto/ivgenpriv.h @@ -40,7 +40,7 @@ struct QCryptoIVGen { QCryptoIVGenDriver *driver; void *private; =20 - QCryptoIVGenAlgorithm algorithm; + QCryptoIVGenAlgo algorithm; QCryptoCipherAlgo cipher; QCryptoHashAlgo hash; }; diff --git a/include/crypto/ivgen.h b/include/crypto/ivgen.h index b059e332cd..bfa5d28103 100644 --- a/include/crypto/ivgen.h +++ b/include/crypto/ivgen.h @@ -44,7 +44,7 @@ * * g_assert((ndata % 512) =3D=3D 0); * - * QCryptoIVGen *ivgen =3D qcrypto_ivgen_new(QCRYPTO_IVGEN_ALG_ESSIV, + * QCryptoIVGen *ivgen =3D qcrypto_ivgen_new(QCRYPTO_IV_GEN_ALGO_ESSIV, * QCRYPTO_CIPHER_ALGO_AES_128, * QCRYPTO_HASH_ALGO_SHA256, * key, nkey, errp); @@ -97,7 +97,7 @@ =20 typedef struct QCryptoIVGen QCryptoIVGen; =20 -/* See also QCryptoIVGenAlgorithm enum in qapi/crypto.json */ +/* See also QCryptoIVGenAlgo enum in qapi/crypto.json */ =20 =20 /** @@ -113,19 +113,19 @@ typedef struct QCryptoIVGen QCryptoIVGen; * are required or not depends on the choice of @alg * requested. * - * - QCRYPTO_IVGEN_ALG_PLAIN + * - QCRYPTO_IV_GEN_ALGO_PLAIN * * The IVs are generated by the 32-bit truncated sector * number. This should never be used for block devices * that are larger than 2^32 sectors in size. * All the other parameters are unused. * - * - QCRYPTO_IVGEN_ALG_PLAIN64 + * - QCRYPTO_IV_GEN_ALGO_PLAIN64 * * The IVs are generated by the 64-bit sector number. * All the other parameters are unused. * - * - QCRYPTO_IVGEN_ALG_ESSIV: + * - QCRYPTO_IV_GEN_ALGO_ESSIV: * * The IVs are generated by encrypting the 64-bit sector * number with a hash of an encryption key. The @cipheralg, @@ -133,7 +133,7 @@ typedef struct QCryptoIVGen QCryptoIVGen; * * Returns: a new IV generator, or NULL on error */ -QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgorithm alg, +QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgo alg, QCryptoCipherAlgo cipheralg, QCryptoHashAlgo hash, const uint8_t *key, size_t nkey, @@ -167,7 +167,7 @@ int qcrypto_ivgen_calculate(QCryptoIVGen *ivgen, * * Returns: the IV generator algorithm */ -QCryptoIVGenAlgorithm qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen); +QCryptoIVGenAlgo qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen); =20 =20 /** diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 8eadf124fc..0926ad28f0 100644 --- a/crypto/block-luks.c +++ b/crypto/block-luks.c @@ -129,7 +129,7 @@ struct QCryptoBlockLUKS { QCryptoCipherMode cipher_mode; =20 /* Initialization vector generation algorithm */ - QCryptoIVGenAlgorithm ivgen_alg; + QCryptoIVGenAlgo ivgen_alg; =20 /* Hash algorithm used for IV generation*/ QCryptoHashAlgo ivgen_hash_alg; @@ -229,7 +229,7 @@ static int qcrypto_block_luks_name_lookup(const char *n= ame, =20 #define qcrypto_block_luks_ivgen_name_lookup(name, errp) \ qcrypto_block_luks_name_lookup(name, \ - &QCryptoIVGenAlgorithm_lookup, \ + &QCryptoIVGenAlgo_lookup, \ "IV generator", \ errp) =20 @@ -660,7 +660,7 @@ qcrypto_block_luks_parse_header(QCryptoBlockLUKS *luks,= Error **errp) return -1; } =20 - if (luks->ivgen_alg =3D=3D QCRYPTO_IVGEN_ALG_ESSIV) { + if (luks->ivgen_alg =3D=3D QCRYPTO_IV_GEN_ALGO_ESSIV) { if (!ivhash_name) { error_setg(errp, "Missing IV generator hash specification"); return -1; @@ -1328,12 +1328,12 @@ qcrypto_block_luks_create(QCryptoBlock *block, luks_opts.cipher_mode =3D QCRYPTO_CIPHER_MODE_XTS; } if (!luks_opts.has_ivgen_alg) { - luks_opts.ivgen_alg =3D QCRYPTO_IVGEN_ALG_PLAIN64; + luks_opts.ivgen_alg =3D QCRYPTO_IV_GEN_ALGO_PLAIN64; } if (!luks_opts.has_hash_alg) { luks_opts.hash_alg =3D QCRYPTO_HASH_ALGO_SHA256; } - if (luks_opts.ivgen_alg =3D=3D QCRYPTO_IVGEN_ALG_ESSIV) { + if (luks_opts.ivgen_alg =3D=3D QCRYPTO_IV_GEN_ALGO_ESSIV) { if (!luks_opts.has_ivgen_hash_alg) { luks_opts.ivgen_hash_alg =3D QCRYPTO_HASH_ALGO_SHA256; luks_opts.has_ivgen_hash_alg =3D true; @@ -1384,7 +1384,7 @@ qcrypto_block_luks_create(QCryptoBlock *block, } =20 cipher_mode =3D QCryptoCipherMode_str(luks_opts.cipher_mode); - ivgen_alg =3D QCryptoIVGenAlgorithm_str(luks_opts.ivgen_alg); + ivgen_alg =3D QCryptoIVGenAlgo_str(luks_opts.ivgen_alg); if (luks_opts.has_ivgen_hash_alg) { ivgen_hash_alg =3D QCryptoHashAlgo_str(luks_opts.ivgen_hash_alg); cipher_mode_spec =3D g_strdup_printf("%s-%s:%s", cipher_mode, ivge= n_alg, @@ -1411,7 +1411,7 @@ qcrypto_block_luks_create(QCryptoBlock *block, goto error; } =20 - if (luks_opts.ivgen_alg =3D=3D QCRYPTO_IVGEN_ALG_ESSIV) { + if (luks_opts.ivgen_alg =3D=3D QCRYPTO_IV_GEN_ALGO_ESSIV) { luks->ivgen_cipher_alg =3D qcrypto_block_luks_essiv_cipher(luks_opts.cipher_alg, luks_opts.ivgen_hash_alg, @@ -1886,7 +1886,7 @@ static int qcrypto_block_luks_get_info(QCryptoBlock *= block, info->u.luks.cipher_alg =3D luks->cipher_alg; info->u.luks.cipher_mode =3D luks->cipher_mode; info->u.luks.ivgen_alg =3D luks->ivgen_alg; - if (info->u.luks.ivgen_alg =3D=3D QCRYPTO_IVGEN_ALG_ESSIV) { + if (info->u.luks.ivgen_alg =3D=3D QCRYPTO_IV_GEN_ALGO_ESSIV) { info->u.luks.has_ivgen_hash_alg =3D true; info->u.luks.ivgen_hash_alg =3D luks->ivgen_hash_alg; } diff --git a/crypto/block-qcow.c b/crypto/block-qcow.c index a0ba9c1f2e..054078b895 100644 --- a/crypto/block-qcow.c +++ b/crypto/block-qcow.c @@ -64,7 +64,7 @@ qcrypto_block_qcow_init(QCryptoBlock *block, =20 block->niv =3D qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALGO_AES_128, QCRYPTO_CIPHER_MODE_CBC); - block->ivgen =3D qcrypto_ivgen_new(QCRYPTO_IVGEN_ALG_PLAIN64, + block->ivgen =3D qcrypto_ivgen_new(QCRYPTO_IV_GEN_ALGO_PLAIN64, 0, 0, NULL, 0, errp); if (!block->ivgen) { ret =3D -ENOTSUP; diff --git a/crypto/ivgen.c b/crypto/ivgen.c index ec0cb1a25b..6b7d24d889 100644 --- a/crypto/ivgen.c +++ b/crypto/ivgen.c @@ -27,7 +27,7 @@ #include "ivgen-essiv.h" =20 =20 -QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgorithm alg, +QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgo alg, QCryptoCipherAlgo cipheralg, QCryptoHashAlgo hash, const uint8_t *key, size_t nkey, @@ -40,13 +40,13 @@ QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgorithm a= lg, ivgen->hash =3D hash; =20 switch (alg) { - case QCRYPTO_IVGEN_ALG_PLAIN: + case QCRYPTO_IV_GEN_ALGO_PLAIN: ivgen->driver =3D &qcrypto_ivgen_plain; break; - case QCRYPTO_IVGEN_ALG_PLAIN64: + case QCRYPTO_IV_GEN_ALGO_PLAIN64: ivgen->driver =3D &qcrypto_ivgen_plain64; break; - case QCRYPTO_IVGEN_ALG_ESSIV: + case QCRYPTO_IV_GEN_ALGO_ESSIV: ivgen->driver =3D &qcrypto_ivgen_essiv; break; default: @@ -73,7 +73,7 @@ int qcrypto_ivgen_calculate(QCryptoIVGen *ivgen, } =20 =20 -QCryptoIVGenAlgorithm qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen) +QCryptoIVGenAlgo qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen) { return ivgen->algorithm; } diff --git a/tests/unit/test-crypto-block.c b/tests/unit/test-crypto-block.c index 1a0d329368..9217b9a2ef 100644 --- a/tests/unit/test-crypto-block.c +++ b/tests/unit/test-crypto-block.c @@ -81,7 +81,7 @@ static QCryptoBlockCreateOptions luks_create_opts_aes256_= cbc_plain64 =3D { .has_cipher_mode =3D true, .cipher_mode =3D QCRYPTO_CIPHER_MODE_CBC, .has_ivgen_alg =3D true, - .ivgen_alg =3D QCRYPTO_IVGEN_ALG_PLAIN64, + .ivgen_alg =3D QCRYPTO_IV_GEN_ALGO_PLAIN64, }, }; =20 @@ -95,7 +95,7 @@ static QCryptoBlockCreateOptions luks_create_opts_aes256_= cbc_essiv =3D { .has_cipher_mode =3D true, .cipher_mode =3D QCRYPTO_CIPHER_MODE_CBC, .has_ivgen_alg =3D true, - .ivgen_alg =3D QCRYPTO_IVGEN_ALG_ESSIV, + .ivgen_alg =3D QCRYPTO_IV_GEN_ALGO_ESSIV, .has_ivgen_hash_alg =3D true, .ivgen_hash_alg =3D QCRYPTO_HASH_ALGO_SHA256, .has_hash_alg =3D true, @@ -116,7 +116,7 @@ static struct QCryptoBlockTestData { QCryptoCipherMode cipher_mode; QCryptoHashAlgo hash_alg; =20 - QCryptoIVGenAlgorithm ivgen_alg; + QCryptoIVGenAlgo ivgen_alg; QCryptoHashAlgo ivgen_hash; =20 bool slow; @@ -131,7 +131,7 @@ static struct QCryptoBlockTestData { .cipher_alg =3D QCRYPTO_CIPHER_ALGO_AES_128, .cipher_mode =3D QCRYPTO_CIPHER_MODE_CBC, =20 - .ivgen_alg =3D QCRYPTO_IVGEN_ALG_PLAIN64, + .ivgen_alg =3D QCRYPTO_IV_GEN_ALGO_PLAIN64, }, #ifdef TEST_LUKS { @@ -145,7 +145,7 @@ static struct QCryptoBlockTestData { .cipher_mode =3D QCRYPTO_CIPHER_MODE_XTS, .hash_alg =3D QCRYPTO_HASH_ALGO_SHA256, =20 - .ivgen_alg =3D QCRYPTO_IVGEN_ALG_PLAIN64, + .ivgen_alg =3D QCRYPTO_IV_GEN_ALGO_PLAIN64, =20 .slow =3D true, }, @@ -160,7 +160,7 @@ static struct QCryptoBlockTestData { .cipher_mode =3D QCRYPTO_CIPHER_MODE_CBC, .hash_alg =3D QCRYPTO_HASH_ALGO_SHA256, =20 - .ivgen_alg =3D QCRYPTO_IVGEN_ALG_PLAIN64, + .ivgen_alg =3D QCRYPTO_IV_GEN_ALGO_PLAIN64, =20 .slow =3D true, }, @@ -175,7 +175,7 @@ static struct QCryptoBlockTestData { .cipher_mode =3D QCRYPTO_CIPHER_MODE_CBC, .hash_alg =3D QCRYPTO_HASH_ALGO_SHA1, =20 - .ivgen_alg =3D QCRYPTO_IVGEN_ALG_ESSIV, + .ivgen_alg =3D QCRYPTO_IV_GEN_ALGO_ESSIV, .ivgen_hash =3D QCRYPTO_HASH_ALGO_SHA256, =20 .slow =3D true, diff --git a/tests/unit/test-crypto-ivgen.c b/tests/unit/test-crypto-ivgen.c index 6b4110775a..bc9ffe34e7 100644 --- a/tests/unit/test-crypto-ivgen.c +++ b/tests/unit/test-crypto-ivgen.c @@ -26,7 +26,7 @@ struct QCryptoIVGenTestData { const char *path; uint64_t sector; - QCryptoIVGenAlgorithm ivalg; + QCryptoIVGenAlgo ivalg; QCryptoHashAlgo hashalg; QCryptoCipherAlgo cipheralg; const uint8_t *key; @@ -38,7 +38,7 @@ struct QCryptoIVGenTestData { { "/crypto/ivgen/plain/1", .sector =3D 0x1, - .ivalg =3D QCRYPTO_IVGEN_ALG_PLAIN, + .ivalg =3D QCRYPTO_IV_GEN_ALGO_PLAIN, .iv =3D (const uint8_t *)"\x01\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", .niv =3D 16, @@ -47,7 +47,7 @@ struct QCryptoIVGenTestData { { "/crypto/ivgen/plain/1f2e3d4c", .sector =3D 0x1f2e3d4cULL, - .ivalg =3D QCRYPTO_IVGEN_ALG_PLAIN, + .ivalg =3D QCRYPTO_IV_GEN_ALGO_PLAIN, .iv =3D (const uint8_t *)"\x4c\x3d\x2e\x1f\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", .niv =3D 16, @@ -56,7 +56,7 @@ struct QCryptoIVGenTestData { { "/crypto/ivgen/plain/1f2e3d4c5b6a7988", .sector =3D 0x1f2e3d4c5b6a7988ULL, - .ivalg =3D QCRYPTO_IVGEN_ALG_PLAIN, + .ivalg =3D QCRYPTO_IV_GEN_ALGO_PLAIN, .iv =3D (const uint8_t *)"\x88\x79\x6a\x5b\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", .niv =3D 16, @@ -65,7 +65,7 @@ struct QCryptoIVGenTestData { { "/crypto/ivgen/plain64/1", .sector =3D 0x1, - .ivalg =3D QCRYPTO_IVGEN_ALG_PLAIN64, + .ivalg =3D QCRYPTO_IV_GEN_ALGO_PLAIN64, .iv =3D (const uint8_t *)"\x01\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", .niv =3D 16, @@ -74,7 +74,7 @@ struct QCryptoIVGenTestData { { "/crypto/ivgen/plain64/1f2e3d4c", .sector =3D 0x1f2e3d4cULL, - .ivalg =3D QCRYPTO_IVGEN_ALG_PLAIN64, + .ivalg =3D QCRYPTO_IV_GEN_ALGO_PLAIN64, .iv =3D (const uint8_t *)"\x4c\x3d\x2e\x1f\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", .niv =3D 16, @@ -83,7 +83,7 @@ struct QCryptoIVGenTestData { { "/crypto/ivgen/plain64/1f2e3d4c5b6a7988", .sector =3D 0x1f2e3d4c5b6a7988ULL, - .ivalg =3D QCRYPTO_IVGEN_ALG_PLAIN64, + .ivalg =3D QCRYPTO_IV_GEN_ALGO_PLAIN64, .iv =3D (const uint8_t *)"\x88\x79\x6a\x5b\x4c\x3d\x2e\x1f" "\x00\x00\x00\x00\x00\x00\x00\x00", .niv =3D 16, @@ -92,7 +92,7 @@ struct QCryptoIVGenTestData { { "/crypto/ivgen/essiv/1", .sector =3D 0x1, - .ivalg =3D QCRYPTO_IVGEN_ALG_ESSIV, + .ivalg =3D QCRYPTO_IV_GEN_ALGO_ESSIV, .cipheralg =3D QCRYPTO_CIPHER_ALGO_AES_128, .hashalg =3D QCRYPTO_HASH_ALGO_SHA256, .key =3D (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07" @@ -106,7 +106,7 @@ struct QCryptoIVGenTestData { { "/crypto/ivgen/essiv/1f2e3d4c", .sector =3D 0x1f2e3d4cULL, - .ivalg =3D QCRYPTO_IVGEN_ALG_ESSIV, + .ivalg =3D QCRYPTO_IV_GEN_ALGO_ESSIV, .cipheralg =3D QCRYPTO_CIPHER_ALGO_AES_128, .hashalg =3D QCRYPTO_HASH_ALGO_SHA256, .key =3D (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07" @@ -120,7 +120,7 @@ struct QCryptoIVGenTestData { { "/crypto/ivgen/essiv/1f2e3d4c5b6a7988", .sector =3D 0x1f2e3d4c5b6a7988ULL, - .ivalg =3D QCRYPTO_IVGEN_ALG_ESSIV, + .ivalg =3D QCRYPTO_IV_GEN_ALGO_ESSIV, .cipheralg =3D QCRYPTO_CIPHER_ALGO_AES_128, .hashalg =3D QCRYPTO_HASH_ALGO_SHA256, .key =3D (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07" @@ -166,7 +166,7 @@ int main(int argc, char **argv) size_t i; g_test_init(&argc, &argv, NULL); for (i =3D 0; i < G_N_ELEMENTS(test_data); i++) { - if (test_data[i].ivalg =3D=3D QCRYPTO_IVGEN_ALG_ESSIV && + if (test_data[i].ivalg =3D=3D QCRYPTO_IV_GEN_ALGO_ESSIV && !qcrypto_hash_supports(test_data[i].hashalg)) { continue; } --=20 2.45.0