diff options
author | Markus Armbruster <armbru@redhat.com> | 2024-09-04 13:18:29 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2024-09-10 14:03:30 +0200 |
commit | a092c513dbb1e504ed1556e70ad263df54016e78 (patch) | |
tree | b81ae49abf0c6239826c29023c230c3b93487800 /backends | |
parent | ef834aa2b2b52ac44ca97d70d5ef5e975a229034 (diff) |
qapi/crypto: Rename QCryptoCipherAlgorithm 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.
QCryptoCipherAlgorithm has a 'prefix' that overrides the generated
enumeration constants' prefix to QCRYPTO_CIPHER_ALG.
We could simply drop 'prefix', but then the prefix becomes
QCRYPTO_CIPHER_ALGORITHM, which is rather long.
We could additionally rename the type to QCryptoCipherAlg, but I think
the abbreviation "alg" is less than clear.
Rename the type to QCryptoCipherAlgo instead. The prefix becomes
QCRYPTO_CIPHER_ALGO.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20240904111836.3273842-13-armbru@redhat.com>
Diffstat (limited to 'backends')
-rw-r--r-- | backends/cryptodev-builtin.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index 4a49d328ec..2672755661 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -138,18 +138,18 @@ cryptodev_builtin_get_aes_algo(uint32_t key_len, int mode, Error **errp) int algo; if (key_len == AES_KEYSIZE_128) { - algo = QCRYPTO_CIPHER_ALG_AES_128; + algo = QCRYPTO_CIPHER_ALGO_AES_128; } else if (key_len == AES_KEYSIZE_192) { - algo = QCRYPTO_CIPHER_ALG_AES_192; + algo = QCRYPTO_CIPHER_ALGO_AES_192; } else if (key_len == AES_KEYSIZE_256) { /* equals AES_KEYSIZE_128_XTS */ if (mode == QCRYPTO_CIPHER_MODE_XTS) { - algo = QCRYPTO_CIPHER_ALG_AES_128; + algo = QCRYPTO_CIPHER_ALGO_AES_128; } else { - algo = QCRYPTO_CIPHER_ALG_AES_256; + algo = QCRYPTO_CIPHER_ALGO_AES_256; } } else if (key_len == AES_KEYSIZE_256_XTS) { if (mode == QCRYPTO_CIPHER_MODE_XTS) { - algo = QCRYPTO_CIPHER_ALG_AES_256; + algo = QCRYPTO_CIPHER_ALGO_AES_256; } else { goto err; } @@ -271,15 +271,15 @@ static int cryptodev_builtin_create_cipher_session( break; case VIRTIO_CRYPTO_CIPHER_3DES_ECB: mode = QCRYPTO_CIPHER_MODE_ECB; - algo = QCRYPTO_CIPHER_ALG_3DES; + algo = QCRYPTO_CIPHER_ALGO_3DES; break; case VIRTIO_CRYPTO_CIPHER_3DES_CBC: mode = QCRYPTO_CIPHER_MODE_CBC; - algo = QCRYPTO_CIPHER_ALG_3DES; + algo = QCRYPTO_CIPHER_ALGO_3DES; break; case VIRTIO_CRYPTO_CIPHER_3DES_CTR: mode = QCRYPTO_CIPHER_MODE_CTR; - algo = QCRYPTO_CIPHER_ALG_3DES; + algo = QCRYPTO_CIPHER_ALGO_3DES; break; default: error_setg(errp, "Unsupported cipher alg :%u", |