qapi/crypto: Rename QCryptoIVGenAlgorithm to *Algo, and drop prefix

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 <armbru@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20240904111836.3273842-14-armbru@redhat.com>
This commit is contained in:
Markus Armbruster 2024-09-04 13:18:30 +02:00
parent a092c513db
commit 5e0e510246
8 changed files with 44 additions and 45 deletions

View File

@ -129,7 +129,7 @@ struct QCryptoBlockLUKS {
QCryptoCipherMode cipher_mode; QCryptoCipherMode cipher_mode;
/* Initialization vector generation algorithm */ /* Initialization vector generation algorithm */
QCryptoIVGenAlgorithm ivgen_alg; QCryptoIVGenAlgo ivgen_alg;
/* Hash algorithm used for IV generation*/ /* Hash algorithm used for IV generation*/
QCryptoHashAlgo ivgen_hash_alg; QCryptoHashAlgo ivgen_hash_alg;
@ -229,7 +229,7 @@ static int qcrypto_block_luks_name_lookup(const char *name,
#define qcrypto_block_luks_ivgen_name_lookup(name, errp) \ #define qcrypto_block_luks_ivgen_name_lookup(name, errp) \
qcrypto_block_luks_name_lookup(name, \ qcrypto_block_luks_name_lookup(name, \
&QCryptoIVGenAlgorithm_lookup, \ &QCryptoIVGenAlgo_lookup, \
"IV generator", \ "IV generator", \
errp) errp)
@ -660,7 +660,7 @@ qcrypto_block_luks_parse_header(QCryptoBlockLUKS *luks, Error **errp)
return -1; return -1;
} }
if (luks->ivgen_alg == QCRYPTO_IVGEN_ALG_ESSIV) { if (luks->ivgen_alg == QCRYPTO_IV_GEN_ALGO_ESSIV) {
if (!ivhash_name) { if (!ivhash_name) {
error_setg(errp, "Missing IV generator hash specification"); error_setg(errp, "Missing IV generator hash specification");
return -1; return -1;
@ -1328,12 +1328,12 @@ qcrypto_block_luks_create(QCryptoBlock *block,
luks_opts.cipher_mode = QCRYPTO_CIPHER_MODE_XTS; luks_opts.cipher_mode = QCRYPTO_CIPHER_MODE_XTS;
} }
if (!luks_opts.has_ivgen_alg) { if (!luks_opts.has_ivgen_alg) {
luks_opts.ivgen_alg = QCRYPTO_IVGEN_ALG_PLAIN64; luks_opts.ivgen_alg = QCRYPTO_IV_GEN_ALGO_PLAIN64;
} }
if (!luks_opts.has_hash_alg) { if (!luks_opts.has_hash_alg) {
luks_opts.hash_alg = QCRYPTO_HASH_ALGO_SHA256; luks_opts.hash_alg = QCRYPTO_HASH_ALGO_SHA256;
} }
if (luks_opts.ivgen_alg == QCRYPTO_IVGEN_ALG_ESSIV) { if (luks_opts.ivgen_alg == QCRYPTO_IV_GEN_ALGO_ESSIV) {
if (!luks_opts.has_ivgen_hash_alg) { if (!luks_opts.has_ivgen_hash_alg) {
luks_opts.ivgen_hash_alg = QCRYPTO_HASH_ALGO_SHA256; luks_opts.ivgen_hash_alg = QCRYPTO_HASH_ALGO_SHA256;
luks_opts.has_ivgen_hash_alg = true; luks_opts.has_ivgen_hash_alg = true;
@ -1384,7 +1384,7 @@ qcrypto_block_luks_create(QCryptoBlock *block,
} }
cipher_mode = QCryptoCipherMode_str(luks_opts.cipher_mode); cipher_mode = QCryptoCipherMode_str(luks_opts.cipher_mode);
ivgen_alg = QCryptoIVGenAlgorithm_str(luks_opts.ivgen_alg); ivgen_alg = QCryptoIVGenAlgo_str(luks_opts.ivgen_alg);
if (luks_opts.has_ivgen_hash_alg) { if (luks_opts.has_ivgen_hash_alg) {
ivgen_hash_alg = QCryptoHashAlgo_str(luks_opts.ivgen_hash_alg); ivgen_hash_alg = QCryptoHashAlgo_str(luks_opts.ivgen_hash_alg);
cipher_mode_spec = g_strdup_printf("%s-%s:%s", cipher_mode, ivgen_alg, cipher_mode_spec = g_strdup_printf("%s-%s:%s", cipher_mode, ivgen_alg,
@ -1411,7 +1411,7 @@ qcrypto_block_luks_create(QCryptoBlock *block,
goto error; goto error;
} }
if (luks_opts.ivgen_alg == QCRYPTO_IVGEN_ALG_ESSIV) { if (luks_opts.ivgen_alg == QCRYPTO_IV_GEN_ALGO_ESSIV) {
luks->ivgen_cipher_alg = luks->ivgen_cipher_alg =
qcrypto_block_luks_essiv_cipher(luks_opts.cipher_alg, qcrypto_block_luks_essiv_cipher(luks_opts.cipher_alg,
luks_opts.ivgen_hash_alg, luks_opts.ivgen_hash_alg,
@ -1886,7 +1886,7 @@ static int qcrypto_block_luks_get_info(QCryptoBlock *block,
info->u.luks.cipher_alg = luks->cipher_alg; info->u.luks.cipher_alg = luks->cipher_alg;
info->u.luks.cipher_mode = luks->cipher_mode; info->u.luks.cipher_mode = luks->cipher_mode;
info->u.luks.ivgen_alg = luks->ivgen_alg; info->u.luks.ivgen_alg = luks->ivgen_alg;
if (info->u.luks.ivgen_alg == QCRYPTO_IVGEN_ALG_ESSIV) { if (info->u.luks.ivgen_alg == QCRYPTO_IV_GEN_ALGO_ESSIV) {
info->u.luks.has_ivgen_hash_alg = true; info->u.luks.has_ivgen_hash_alg = true;
info->u.luks.ivgen_hash_alg = luks->ivgen_hash_alg; info->u.luks.ivgen_hash_alg = luks->ivgen_hash_alg;
} }

View File

@ -64,7 +64,7 @@ qcrypto_block_qcow_init(QCryptoBlock *block,
block->niv = qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALGO_AES_128, block->niv = qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALGO_AES_128,
QCRYPTO_CIPHER_MODE_CBC); QCRYPTO_CIPHER_MODE_CBC);
block->ivgen = qcrypto_ivgen_new(QCRYPTO_IVGEN_ALG_PLAIN64, block->ivgen = qcrypto_ivgen_new(QCRYPTO_IV_GEN_ALGO_PLAIN64,
0, 0, NULL, 0, errp); 0, 0, NULL, 0, errp);
if (!block->ivgen) { if (!block->ivgen) {
ret = -ENOTSUP; ret = -ENOTSUP;

View File

@ -27,7 +27,7 @@
#include "ivgen-essiv.h" #include "ivgen-essiv.h"
QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgorithm alg, QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgo alg,
QCryptoCipherAlgo cipheralg, QCryptoCipherAlgo cipheralg,
QCryptoHashAlgo hash, QCryptoHashAlgo hash,
const uint8_t *key, size_t nkey, const uint8_t *key, size_t nkey,
@ -40,13 +40,13 @@ QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgorithm alg,
ivgen->hash = hash; ivgen->hash = hash;
switch (alg) { switch (alg) {
case QCRYPTO_IVGEN_ALG_PLAIN: case QCRYPTO_IV_GEN_ALGO_PLAIN:
ivgen->driver = &qcrypto_ivgen_plain; ivgen->driver = &qcrypto_ivgen_plain;
break; break;
case QCRYPTO_IVGEN_ALG_PLAIN64: case QCRYPTO_IV_GEN_ALGO_PLAIN64:
ivgen->driver = &qcrypto_ivgen_plain64; ivgen->driver = &qcrypto_ivgen_plain64;
break; break;
case QCRYPTO_IVGEN_ALG_ESSIV: case QCRYPTO_IV_GEN_ALGO_ESSIV:
ivgen->driver = &qcrypto_ivgen_essiv; ivgen->driver = &qcrypto_ivgen_essiv;
break; break;
default: default:
@ -73,7 +73,7 @@ int qcrypto_ivgen_calculate(QCryptoIVGen *ivgen,
} }
QCryptoIVGenAlgorithm qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen) QCryptoIVGenAlgo qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen)
{ {
return ivgen->algorithm; return ivgen->algorithm;
} }

View File

@ -40,7 +40,7 @@ struct QCryptoIVGen {
QCryptoIVGenDriver *driver; QCryptoIVGenDriver *driver;
void *private; void *private;
QCryptoIVGenAlgorithm algorithm; QCryptoIVGenAlgo algorithm;
QCryptoCipherAlgo cipher; QCryptoCipherAlgo cipher;
QCryptoHashAlgo hash; QCryptoHashAlgo hash;
}; };

View File

@ -44,7 +44,7 @@
* *
* g_assert((ndata % 512) == 0); * g_assert((ndata % 512) == 0);
* *
* QCryptoIVGen *ivgen = qcrypto_ivgen_new(QCRYPTO_IVGEN_ALG_ESSIV, * QCryptoIVGen *ivgen = qcrypto_ivgen_new(QCRYPTO_IV_GEN_ALGO_ESSIV,
* QCRYPTO_CIPHER_ALGO_AES_128, * QCRYPTO_CIPHER_ALGO_AES_128,
* QCRYPTO_HASH_ALGO_SHA256, * QCRYPTO_HASH_ALGO_SHA256,
* key, nkey, errp); * key, nkey, errp);
@ -97,7 +97,7 @@
typedef struct QCryptoIVGen QCryptoIVGen; typedef struct QCryptoIVGen QCryptoIVGen;
/* See also QCryptoIVGenAlgorithm enum in qapi/crypto.json */ /* See also QCryptoIVGenAlgo enum in qapi/crypto.json */
/** /**
@ -113,19 +113,19 @@ typedef struct QCryptoIVGen QCryptoIVGen;
* are required or not depends on the choice of @alg * are required or not depends on the choice of @alg
* requested. * requested.
* *
* - QCRYPTO_IVGEN_ALG_PLAIN * - QCRYPTO_IV_GEN_ALGO_PLAIN
* *
* The IVs are generated by the 32-bit truncated sector * The IVs are generated by the 32-bit truncated sector
* number. This should never be used for block devices * number. This should never be used for block devices
* that are larger than 2^32 sectors in size. * that are larger than 2^32 sectors in size.
* All the other parameters are unused. * 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. * The IVs are generated by the 64-bit sector number.
* All the other parameters are unused. * 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 * The IVs are generated by encrypting the 64-bit sector
* number with a hash of an encryption key. The @cipheralg, * 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 * Returns: a new IV generator, or NULL on error
*/ */
QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgorithm alg, QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgo alg,
QCryptoCipherAlgo cipheralg, QCryptoCipherAlgo cipheralg,
QCryptoHashAlgo hash, QCryptoHashAlgo hash,
const uint8_t *key, size_t nkey, const uint8_t *key, size_t nkey,
@ -167,7 +167,7 @@ int qcrypto_ivgen_calculate(QCryptoIVGen *ivgen,
* *
* Returns: the IV generator algorithm * Returns: the IV generator algorithm
*/ */
QCryptoIVGenAlgorithm qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen); QCryptoIVGenAlgo qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen);
/** /**

View File

@ -122,7 +122,7 @@
'data': ['ecb', 'cbc', 'xts', 'ctr']} 'data': ['ecb', 'cbc', 'xts', 'ctr']}
## ##
# @QCryptoIVGenAlgorithm: # @QCryptoIVGenAlgo:
# #
# The supported algorithms for generating initialization vectors for # The supported algorithms for generating initialization vectors for
# full disk encryption. The 'plain' generator should not be used for # full disk encryption. The 'plain' generator should not be used for
@ -138,8 +138,7 @@
# #
# Since: 2.6 # Since: 2.6
## ##
{ 'enum': 'QCryptoIVGenAlgorithm', { 'enum': 'QCryptoIVGenAlgo',
'prefix': 'QCRYPTO_IVGEN_ALG',
'data': ['plain', 'plain64', 'essiv']} 'data': ['plain', 'plain64', 'essiv']}
## ##
@ -226,7 +225,7 @@
'base': 'QCryptoBlockOptionsLUKS', 'base': 'QCryptoBlockOptionsLUKS',
'data': { '*cipher-alg': 'QCryptoCipherAlgo', 'data': { '*cipher-alg': 'QCryptoCipherAlgo',
'*cipher-mode': 'QCryptoCipherMode', '*cipher-mode': 'QCryptoCipherMode',
'*ivgen-alg': 'QCryptoIVGenAlgorithm', '*ivgen-alg': 'QCryptoIVGenAlgo',
'*ivgen-hash-alg': 'QCryptoHashAlgo', '*ivgen-hash-alg': 'QCryptoHashAlgo',
'*hash-alg': 'QCryptoHashAlgo', '*hash-alg': 'QCryptoHashAlgo',
'*iter-time': 'int' }} '*iter-time': 'int' }}
@ -323,7 +322,7 @@
{ 'struct': 'QCryptoBlockInfoLUKS', { 'struct': 'QCryptoBlockInfoLUKS',
'data': {'cipher-alg': 'QCryptoCipherAlgo', 'data': {'cipher-alg': 'QCryptoCipherAlgo',
'cipher-mode': 'QCryptoCipherMode', 'cipher-mode': 'QCryptoCipherMode',
'ivgen-alg': 'QCryptoIVGenAlgorithm', 'ivgen-alg': 'QCryptoIVGenAlgo',
'*ivgen-hash-alg': 'QCryptoHashAlgo', '*ivgen-hash-alg': 'QCryptoHashAlgo',
'hash-alg': 'QCryptoHashAlgo', 'hash-alg': 'QCryptoHashAlgo',
'detached-header': 'bool', 'detached-header': 'bool',

View File

@ -81,7 +81,7 @@ static QCryptoBlockCreateOptions luks_create_opts_aes256_cbc_plain64 = {
.has_cipher_mode = true, .has_cipher_mode = true,
.cipher_mode = QCRYPTO_CIPHER_MODE_CBC, .cipher_mode = QCRYPTO_CIPHER_MODE_CBC,
.has_ivgen_alg = true, .has_ivgen_alg = true,
.ivgen_alg = QCRYPTO_IVGEN_ALG_PLAIN64, .ivgen_alg = QCRYPTO_IV_GEN_ALGO_PLAIN64,
}, },
}; };
@ -95,7 +95,7 @@ static QCryptoBlockCreateOptions luks_create_opts_aes256_cbc_essiv = {
.has_cipher_mode = true, .has_cipher_mode = true,
.cipher_mode = QCRYPTO_CIPHER_MODE_CBC, .cipher_mode = QCRYPTO_CIPHER_MODE_CBC,
.has_ivgen_alg = true, .has_ivgen_alg = true,
.ivgen_alg = QCRYPTO_IVGEN_ALG_ESSIV, .ivgen_alg = QCRYPTO_IV_GEN_ALGO_ESSIV,
.has_ivgen_hash_alg = true, .has_ivgen_hash_alg = true,
.ivgen_hash_alg = QCRYPTO_HASH_ALGO_SHA256, .ivgen_hash_alg = QCRYPTO_HASH_ALGO_SHA256,
.has_hash_alg = true, .has_hash_alg = true,
@ -116,7 +116,7 @@ static struct QCryptoBlockTestData {
QCryptoCipherMode cipher_mode; QCryptoCipherMode cipher_mode;
QCryptoHashAlgo hash_alg; QCryptoHashAlgo hash_alg;
QCryptoIVGenAlgorithm ivgen_alg; QCryptoIVGenAlgo ivgen_alg;
QCryptoHashAlgo ivgen_hash; QCryptoHashAlgo ivgen_hash;
bool slow; bool slow;
@ -131,7 +131,7 @@ static struct QCryptoBlockTestData {
.cipher_alg = QCRYPTO_CIPHER_ALGO_AES_128, .cipher_alg = QCRYPTO_CIPHER_ALGO_AES_128,
.cipher_mode = QCRYPTO_CIPHER_MODE_CBC, .cipher_mode = QCRYPTO_CIPHER_MODE_CBC,
.ivgen_alg = QCRYPTO_IVGEN_ALG_PLAIN64, .ivgen_alg = QCRYPTO_IV_GEN_ALGO_PLAIN64,
}, },
#ifdef TEST_LUKS #ifdef TEST_LUKS
{ {
@ -145,7 +145,7 @@ static struct QCryptoBlockTestData {
.cipher_mode = QCRYPTO_CIPHER_MODE_XTS, .cipher_mode = QCRYPTO_CIPHER_MODE_XTS,
.hash_alg = QCRYPTO_HASH_ALGO_SHA256, .hash_alg = QCRYPTO_HASH_ALGO_SHA256,
.ivgen_alg = QCRYPTO_IVGEN_ALG_PLAIN64, .ivgen_alg = QCRYPTO_IV_GEN_ALGO_PLAIN64,
.slow = true, .slow = true,
}, },
@ -160,7 +160,7 @@ static struct QCryptoBlockTestData {
.cipher_mode = QCRYPTO_CIPHER_MODE_CBC, .cipher_mode = QCRYPTO_CIPHER_MODE_CBC,
.hash_alg = QCRYPTO_HASH_ALGO_SHA256, .hash_alg = QCRYPTO_HASH_ALGO_SHA256,
.ivgen_alg = QCRYPTO_IVGEN_ALG_PLAIN64, .ivgen_alg = QCRYPTO_IV_GEN_ALGO_PLAIN64,
.slow = true, .slow = true,
}, },
@ -175,7 +175,7 @@ static struct QCryptoBlockTestData {
.cipher_mode = QCRYPTO_CIPHER_MODE_CBC, .cipher_mode = QCRYPTO_CIPHER_MODE_CBC,
.hash_alg = QCRYPTO_HASH_ALGO_SHA1, .hash_alg = QCRYPTO_HASH_ALGO_SHA1,
.ivgen_alg = QCRYPTO_IVGEN_ALG_ESSIV, .ivgen_alg = QCRYPTO_IV_GEN_ALGO_ESSIV,
.ivgen_hash = QCRYPTO_HASH_ALGO_SHA256, .ivgen_hash = QCRYPTO_HASH_ALGO_SHA256,
.slow = true, .slow = true,

View File

@ -26,7 +26,7 @@
struct QCryptoIVGenTestData { struct QCryptoIVGenTestData {
const char *path; const char *path;
uint64_t sector; uint64_t sector;
QCryptoIVGenAlgorithm ivalg; QCryptoIVGenAlgo ivalg;
QCryptoHashAlgo hashalg; QCryptoHashAlgo hashalg;
QCryptoCipherAlgo cipheralg; QCryptoCipherAlgo cipheralg;
const uint8_t *key; const uint8_t *key;
@ -38,7 +38,7 @@ struct QCryptoIVGenTestData {
{ {
"/crypto/ivgen/plain/1", "/crypto/ivgen/plain/1",
.sector = 0x1, .sector = 0x1,
.ivalg = QCRYPTO_IVGEN_ALG_PLAIN, .ivalg = QCRYPTO_IV_GEN_ALGO_PLAIN,
.iv = (const uint8_t *)"\x01\x00\x00\x00\x00\x00\x00\x00" .iv = (const uint8_t *)"\x01\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00", "\x00\x00\x00\x00\x00\x00\x00\x00",
.niv = 16, .niv = 16,
@ -47,7 +47,7 @@ struct QCryptoIVGenTestData {
{ {
"/crypto/ivgen/plain/1f2e3d4c", "/crypto/ivgen/plain/1f2e3d4c",
.sector = 0x1f2e3d4cULL, .sector = 0x1f2e3d4cULL,
.ivalg = QCRYPTO_IVGEN_ALG_PLAIN, .ivalg = QCRYPTO_IV_GEN_ALGO_PLAIN,
.iv = (const uint8_t *)"\x4c\x3d\x2e\x1f\x00\x00\x00\x00" .iv = (const uint8_t *)"\x4c\x3d\x2e\x1f\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00", "\x00\x00\x00\x00\x00\x00\x00\x00",
.niv = 16, .niv = 16,
@ -56,7 +56,7 @@ struct QCryptoIVGenTestData {
{ {
"/crypto/ivgen/plain/1f2e3d4c5b6a7988", "/crypto/ivgen/plain/1f2e3d4c5b6a7988",
.sector = 0x1f2e3d4c5b6a7988ULL, .sector = 0x1f2e3d4c5b6a7988ULL,
.ivalg = QCRYPTO_IVGEN_ALG_PLAIN, .ivalg = QCRYPTO_IV_GEN_ALGO_PLAIN,
.iv = (const uint8_t *)"\x88\x79\x6a\x5b\x00\x00\x00\x00" .iv = (const uint8_t *)"\x88\x79\x6a\x5b\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00", "\x00\x00\x00\x00\x00\x00\x00\x00",
.niv = 16, .niv = 16,
@ -65,7 +65,7 @@ struct QCryptoIVGenTestData {
{ {
"/crypto/ivgen/plain64/1", "/crypto/ivgen/plain64/1",
.sector = 0x1, .sector = 0x1,
.ivalg = QCRYPTO_IVGEN_ALG_PLAIN64, .ivalg = QCRYPTO_IV_GEN_ALGO_PLAIN64,
.iv = (const uint8_t *)"\x01\x00\x00\x00\x00\x00\x00\x00" .iv = (const uint8_t *)"\x01\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00", "\x00\x00\x00\x00\x00\x00\x00\x00",
.niv = 16, .niv = 16,
@ -74,7 +74,7 @@ struct QCryptoIVGenTestData {
{ {
"/crypto/ivgen/plain64/1f2e3d4c", "/crypto/ivgen/plain64/1f2e3d4c",
.sector = 0x1f2e3d4cULL, .sector = 0x1f2e3d4cULL,
.ivalg = QCRYPTO_IVGEN_ALG_PLAIN64, .ivalg = QCRYPTO_IV_GEN_ALGO_PLAIN64,
.iv = (const uint8_t *)"\x4c\x3d\x2e\x1f\x00\x00\x00\x00" .iv = (const uint8_t *)"\x4c\x3d\x2e\x1f\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00", "\x00\x00\x00\x00\x00\x00\x00\x00",
.niv = 16, .niv = 16,
@ -83,7 +83,7 @@ struct QCryptoIVGenTestData {
{ {
"/crypto/ivgen/plain64/1f2e3d4c5b6a7988", "/crypto/ivgen/plain64/1f2e3d4c5b6a7988",
.sector = 0x1f2e3d4c5b6a7988ULL, .sector = 0x1f2e3d4c5b6a7988ULL,
.ivalg = QCRYPTO_IVGEN_ALG_PLAIN64, .ivalg = QCRYPTO_IV_GEN_ALGO_PLAIN64,
.iv = (const uint8_t *)"\x88\x79\x6a\x5b\x4c\x3d\x2e\x1f" .iv = (const uint8_t *)"\x88\x79\x6a\x5b\x4c\x3d\x2e\x1f"
"\x00\x00\x00\x00\x00\x00\x00\x00", "\x00\x00\x00\x00\x00\x00\x00\x00",
.niv = 16, .niv = 16,
@ -92,7 +92,7 @@ struct QCryptoIVGenTestData {
{ {
"/crypto/ivgen/essiv/1", "/crypto/ivgen/essiv/1",
.sector = 0x1, .sector = 0x1,
.ivalg = QCRYPTO_IVGEN_ALG_ESSIV, .ivalg = QCRYPTO_IV_GEN_ALGO_ESSIV,
.cipheralg = QCRYPTO_CIPHER_ALGO_AES_128, .cipheralg = QCRYPTO_CIPHER_ALGO_AES_128,
.hashalg = QCRYPTO_HASH_ALGO_SHA256, .hashalg = QCRYPTO_HASH_ALGO_SHA256,
.key = (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07" .key = (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07"
@ -106,7 +106,7 @@ struct QCryptoIVGenTestData {
{ {
"/crypto/ivgen/essiv/1f2e3d4c", "/crypto/ivgen/essiv/1f2e3d4c",
.sector = 0x1f2e3d4cULL, .sector = 0x1f2e3d4cULL,
.ivalg = QCRYPTO_IVGEN_ALG_ESSIV, .ivalg = QCRYPTO_IV_GEN_ALGO_ESSIV,
.cipheralg = QCRYPTO_CIPHER_ALGO_AES_128, .cipheralg = QCRYPTO_CIPHER_ALGO_AES_128,
.hashalg = QCRYPTO_HASH_ALGO_SHA256, .hashalg = QCRYPTO_HASH_ALGO_SHA256,
.key = (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07" .key = (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07"
@ -120,7 +120,7 @@ struct QCryptoIVGenTestData {
{ {
"/crypto/ivgen/essiv/1f2e3d4c5b6a7988", "/crypto/ivgen/essiv/1f2e3d4c5b6a7988",
.sector = 0x1f2e3d4c5b6a7988ULL, .sector = 0x1f2e3d4c5b6a7988ULL,
.ivalg = QCRYPTO_IVGEN_ALG_ESSIV, .ivalg = QCRYPTO_IV_GEN_ALGO_ESSIV,
.cipheralg = QCRYPTO_CIPHER_ALGO_AES_128, .cipheralg = QCRYPTO_CIPHER_ALGO_AES_128,
.hashalg = QCRYPTO_HASH_ALGO_SHA256, .hashalg = QCRYPTO_HASH_ALGO_SHA256,
.key = (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07" .key = (const uint8_t *)"\x00\x01\x02\x03\x04\x05\x06\x07"
@ -166,7 +166,7 @@ int main(int argc, char **argv)
size_t i; size_t i;
g_test_init(&argc, &argv, NULL); g_test_init(&argc, &argv, NULL);
for (i = 0; i < G_N_ELEMENTS(test_data); i++) { for (i = 0; i < G_N_ELEMENTS(test_data); i++) {
if (test_data[i].ivalg == QCRYPTO_IVGEN_ALG_ESSIV && if (test_data[i].ivalg == QCRYPTO_IV_GEN_ALGO_ESSIV &&
!qcrypto_hash_supports(test_data[i].hashalg)) { !qcrypto_hash_supports(test_data[i].hashalg)) {
continue; continue;
} }