mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
ef834aa2b2
commit
a092c513db
26 changed files with 277 additions and 278 deletions
|
@ -26,7 +26,7 @@
|
|||
typedef struct QCryptoCipher QCryptoCipher;
|
||||
typedef struct QCryptoCipherDriver QCryptoCipherDriver;
|
||||
|
||||
/* See also "QCryptoCipherAlgorithm" and "QCryptoCipherMode"
|
||||
/* See also "QCryptoCipherAlgo" and "QCryptoCipherMode"
|
||||
* enums defined in qapi/crypto.json */
|
||||
|
||||
/**
|
||||
|
@ -50,12 +50,12 @@ typedef struct QCryptoCipherDriver QCryptoCipherDriver;
|
|||
* size_t keylen = 16;
|
||||
* uint8_t iv = ....;
|
||||
*
|
||||
* if (!qcrypto_cipher_supports(QCRYPTO_CIPHER_ALG_AES_128)) {
|
||||
* if (!qcrypto_cipher_supports(QCRYPTO_CIPHER_ALGO_AES_128)) {
|
||||
* error_report(errp, "Feature <blah> requires AES cipher support");
|
||||
* return -1;
|
||||
* }
|
||||
*
|
||||
* cipher = qcrypto_cipher_new(QCRYPTO_CIPHER_ALG_AES_128,
|
||||
* cipher = qcrypto_cipher_new(QCRYPTO_CIPHER_ALGO_AES_128,
|
||||
* QCRYPTO_CIPHER_MODE_CBC,
|
||||
* key, keylen,
|
||||
* errp);
|
||||
|
@ -78,7 +78,7 @@ typedef struct QCryptoCipherDriver QCryptoCipherDriver;
|
|||
*/
|
||||
|
||||
struct QCryptoCipher {
|
||||
QCryptoCipherAlgorithm alg;
|
||||
QCryptoCipherAlgo alg;
|
||||
QCryptoCipherMode mode;
|
||||
const QCryptoCipherDriver *driver;
|
||||
};
|
||||
|
@ -93,7 +93,7 @@ struct QCryptoCipher {
|
|||
*
|
||||
* Returns: true if the algorithm is supported, false otherwise
|
||||
*/
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode);
|
||||
|
||||
/**
|
||||
|
@ -106,7 +106,7 @@ bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
|
|||
*
|
||||
* Returns: the block size in bytes
|
||||
*/
|
||||
size_t qcrypto_cipher_get_block_len(QCryptoCipherAlgorithm alg);
|
||||
size_t qcrypto_cipher_get_block_len(QCryptoCipherAlgo alg);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -117,7 +117,7 @@ size_t qcrypto_cipher_get_block_len(QCryptoCipherAlgorithm alg);
|
|||
*
|
||||
* Returns: the key size in bytes
|
||||
*/
|
||||
size_t qcrypto_cipher_get_key_len(QCryptoCipherAlgorithm alg);
|
||||
size_t qcrypto_cipher_get_key_len(QCryptoCipherAlgo alg);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -130,7 +130,7 @@ size_t qcrypto_cipher_get_key_len(QCryptoCipherAlgorithm alg);
|
|||
*
|
||||
* Returns: the IV size in bytes, or 0 if no IV is permitted
|
||||
*/
|
||||
size_t qcrypto_cipher_get_iv_len(QCryptoCipherAlgorithm alg,
|
||||
size_t qcrypto_cipher_get_iv_len(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode);
|
||||
|
||||
|
||||
|
@ -156,7 +156,7 @@ size_t qcrypto_cipher_get_iv_len(QCryptoCipherAlgorithm alg,
|
|||
*
|
||||
* Returns: a new cipher object, or NULL on error
|
||||
*/
|
||||
QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
|
||||
QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue