mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -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
|
@ -33,7 +33,7 @@ typedef struct QCryptoGcryptRSA {
|
|||
QCryptoAkCipher akcipher;
|
||||
gcry_sexp_t key;
|
||||
QCryptoRSAPaddingAlgorithm padding_alg;
|
||||
QCryptoHashAlgorithm hash_alg;
|
||||
QCryptoHashAlgo hash_alg;
|
||||
} QCryptoGcryptRSA;
|
||||
|
||||
static void qcrypto_gcrypt_rsa_free(QCryptoAkCipher *akcipher)
|
||||
|
@ -417,7 +417,7 @@ static int qcrypto_gcrypt_rsa_sign(QCryptoAkCipher *akcipher,
|
|||
|
||||
err = gcry_sexp_build(&dgst_sexp, NULL,
|
||||
"(data (flags pkcs1) (hash %s %b))",
|
||||
QCryptoHashAlgorithm_str(rsa->hash_alg),
|
||||
QCryptoHashAlgo_str(rsa->hash_alg),
|
||||
in_len, in);
|
||||
if (gcry_err_code(err) != 0) {
|
||||
error_setg(errp, "Failed to build dgst: %s/%s",
|
||||
|
@ -497,7 +497,7 @@ static int qcrypto_gcrypt_rsa_verify(QCryptoAkCipher *akcipher,
|
|||
|
||||
err = gcry_sexp_build(&dgst_sexp, NULL,
|
||||
"(data (flags pkcs1) (hash %s %b))",
|
||||
QCryptoHashAlgorithm_str(rsa->hash_alg),
|
||||
QCryptoHashAlgo_str(rsa->hash_alg),
|
||||
in2_len, in2);
|
||||
if (gcry_err_code(err) != 0) {
|
||||
error_setg(errp, "Failed to build dgst: %s/%s",
|
||||
|
@ -575,10 +575,10 @@ bool qcrypto_akcipher_supports(QCryptoAkCipherOptions *opts)
|
|||
|
||||
case QCRYPTO_RSA_PADDING_ALG_PKCS1:
|
||||
switch (opts->u.rsa.hash_alg) {
|
||||
case QCRYPTO_HASH_ALG_MD5:
|
||||
case QCRYPTO_HASH_ALG_SHA1:
|
||||
case QCRYPTO_HASH_ALG_SHA256:
|
||||
case QCRYPTO_HASH_ALG_SHA512:
|
||||
case QCRYPTO_HASH_ALGO_MD5:
|
||||
case QCRYPTO_HASH_ALGO_SHA1:
|
||||
case QCRYPTO_HASH_ALGO_SHA256:
|
||||
case QCRYPTO_HASH_ALGO_SHA512:
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue