mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
qapi/crypto: Rename QCryptoHashAlgorithm 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.
QCryptoHashAlgorithm has a 'prefix' that overrides the generated
enumeration constants' prefix to QCRYPTO_HASH_ALG.
We could simply drop 'prefix', but then the prefix becomes
QCRYPTO_HASH_ALGORITHM, which is rather long.
We could additionally rename the type to QCryptoHashAlg, but I think
the abbreviation "alg" is less than clear.
Rename the type to QCryptoHashAlgo instead. The prefix becomes to
QCRYPTO_HASH_ALGO.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20240904111836.3273842-12-armbru@redhat.com>
[Conflicts with merge commit 7bbadc60b5
resolved]
This commit is contained in:
parent
5f4059ef33
commit
ef834aa2b2
54 changed files with 363 additions and 364 deletions
|
@ -20,7 +20,7 @@
|
|||
#include "hmacpriv.h"
|
||||
|
||||
static char *
|
||||
qcrypto_afalg_hash_format_name(QCryptoHashAlgorithm alg,
|
||||
qcrypto_afalg_hash_format_name(QCryptoHashAlgo alg,
|
||||
bool is_hmac,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -28,25 +28,25 @@ qcrypto_afalg_hash_format_name(QCryptoHashAlgorithm alg,
|
|||
const char *alg_name;
|
||||
|
||||
switch (alg) {
|
||||
case QCRYPTO_HASH_ALG_MD5:
|
||||
case QCRYPTO_HASH_ALGO_MD5:
|
||||
alg_name = "md5";
|
||||
break;
|
||||
case QCRYPTO_HASH_ALG_SHA1:
|
||||
case QCRYPTO_HASH_ALGO_SHA1:
|
||||
alg_name = "sha1";
|
||||
break;
|
||||
case QCRYPTO_HASH_ALG_SHA224:
|
||||
case QCRYPTO_HASH_ALGO_SHA224:
|
||||
alg_name = "sha224";
|
||||
break;
|
||||
case QCRYPTO_HASH_ALG_SHA256:
|
||||
case QCRYPTO_HASH_ALGO_SHA256:
|
||||
alg_name = "sha256";
|
||||
break;
|
||||
case QCRYPTO_HASH_ALG_SHA384:
|
||||
case QCRYPTO_HASH_ALGO_SHA384:
|
||||
alg_name = "sha384";
|
||||
break;
|
||||
case QCRYPTO_HASH_ALG_SHA512:
|
||||
case QCRYPTO_HASH_ALGO_SHA512:
|
||||
alg_name = "sha512";
|
||||
break;
|
||||
case QCRYPTO_HASH_ALG_RIPEMD160:
|
||||
case QCRYPTO_HASH_ALGO_RIPEMD160:
|
||||
alg_name = "rmd160";
|
||||
break;
|
||||
|
||||
|
@ -65,7 +65,7 @@ qcrypto_afalg_hash_format_name(QCryptoHashAlgorithm alg,
|
|||
}
|
||||
|
||||
static QCryptoAFAlg *
|
||||
qcrypto_afalg_hash_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
qcrypto_afalg_hash_hmac_ctx_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
bool is_hmac, Error **errp)
|
||||
{
|
||||
|
@ -99,14 +99,14 @@ qcrypto_afalg_hash_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
|||
}
|
||||
|
||||
static QCryptoAFAlg *
|
||||
qcrypto_afalg_hash_ctx_new(QCryptoHashAlgorithm alg,
|
||||
qcrypto_afalg_hash_ctx_new(QCryptoHashAlgo alg,
|
||||
Error **errp)
|
||||
{
|
||||
return qcrypto_afalg_hash_hmac_ctx_new(alg, NULL, 0, false, errp);
|
||||
}
|
||||
|
||||
QCryptoAFAlg *
|
||||
qcrypto_afalg_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
qcrypto_afalg_hmac_ctx_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ qcrypto_afalg_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
|||
|
||||
static int
|
||||
qcrypto_afalg_hash_hmac_bytesv(QCryptoAFAlg *hmac,
|
||||
QCryptoHashAlgorithm alg,
|
||||
QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov, uint8_t **result,
|
||||
size_t *resultlen,
|
||||
|
@ -173,7 +173,7 @@ out:
|
|||
}
|
||||
|
||||
static int
|
||||
qcrypto_afalg_hash_bytesv(QCryptoHashAlgorithm alg,
|
||||
qcrypto_afalg_hash_bytesv(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov, uint8_t **result,
|
||||
size_t *resultlen,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue