qapi/crypto: Rename QCryptoAkCipherAlgorithm 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. QCryptoAkCipherAlgorithm has a 'prefix' that overrides the generated enumeration constants' prefix to QCRYPTO_AKCIPHER_ALG. We could simply drop 'prefix', but then the prefix becomes QCRYPTO_AK_CIPHER_ALGORITHM, which is rather long. We could additionally rename the type to QCryptoAkCipherAlg, but I think the abbreviation "alg" is less than clear. Rename the type to QCryptoAkCipherAlgo instead. The prefix becomes QCRYPTO_AK_CIPHER_ALGO. Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240904111836.3273842-15-armbru@redhat.com>
This commit is contained in:
@@ -59,7 +59,7 @@ QCryptoAkCipher *qcrypto_akcipher_new(const QCryptoAkCipherOptions *opts,
|
||||
Error **errp)
|
||||
{
|
||||
switch (opts->alg) {
|
||||
case QCRYPTO_AKCIPHER_ALG_RSA:
|
||||
case QCRYPTO_AK_CIPHER_ALGO_RSA:
|
||||
return (QCryptoAkCipher *)qcrypto_gcrypt_rsa_new(
|
||||
&opts->u.rsa, type, key, keylen, errp);
|
||||
|
||||
@@ -568,7 +568,7 @@ error:
|
||||
bool qcrypto_akcipher_supports(QCryptoAkCipherOptions *opts)
|
||||
{
|
||||
switch (opts->alg) {
|
||||
case QCRYPTO_AKCIPHER_ALG_RSA:
|
||||
case QCRYPTO_AK_CIPHER_ALGO_RSA:
|
||||
switch (opts->u.rsa.padding_alg) {
|
||||
case QCRYPTO_RSA_PADDING_ALG_RAW:
|
||||
return true;
|
||||
|
||||
@@ -61,7 +61,7 @@ QCryptoAkCipher *qcrypto_akcipher_new(const QCryptoAkCipherOptions *opts,
|
||||
Error **errp)
|
||||
{
|
||||
switch (opts->alg) {
|
||||
case QCRYPTO_AKCIPHER_ALG_RSA:
|
||||
case QCRYPTO_AK_CIPHER_ALGO_RSA:
|
||||
return qcrypto_nettle_rsa_new(&opts->u.rsa, type, key, keylen, errp);
|
||||
|
||||
default:
|
||||
@@ -425,7 +425,7 @@ error:
|
||||
bool qcrypto_akcipher_supports(QCryptoAkCipherOptions *opts)
|
||||
{
|
||||
switch (opts->alg) {
|
||||
case QCRYPTO_AKCIPHER_ALG_RSA:
|
||||
case QCRYPTO_AK_CIPHER_ALGO_RSA:
|
||||
switch (opts->u.rsa.padding_alg) {
|
||||
case QCRYPTO_RSA_PADDING_ALG_PKCS1:
|
||||
switch (opts->u.rsa.hash_alg) {
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ int qcrypto_akcipher_export_p8info(const QCryptoAkCipherOptions *opts,
|
||||
Error **errp)
|
||||
{
|
||||
switch (opts->alg) {
|
||||
case QCRYPTO_AKCIPHER_ALG_RSA:
|
||||
case QCRYPTO_AK_CIPHER_ALGO_RSA:
|
||||
qcrypto_akcipher_rsakey_export_p8info(key, keylen, dst, dst_len);
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
typedef struct QCryptoAkCipherDriver QCryptoAkCipherDriver;
|
||||
|
||||
struct QCryptoAkCipher {
|
||||
QCryptoAkCipherAlgorithm alg;
|
||||
QCryptoAkCipherAlgo alg;
|
||||
QCryptoAkCipherKeyType type;
|
||||
int max_plaintext_len;
|
||||
int max_ciphertext_len;
|
||||
|
||||
Reference in New Issue
Block a user