mirror of https://github.com/xemu-project/xemu.git
QAPI patches patches for 2024-09-10
-----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmbgS0ASHGFybWJydUBy ZWRoYXQuY29tAAoJEDhwtADrkYZTm+sP/1kEuGdbjjVLQC7U+gCClhALpYUtIMHQ qNZWmnxFyW9Jx6Lk8+FZBRJegNlmA9AJ2ZzD/2I/WoNtcrNiE53rIRG71Lcy8I6U CRjekLPn0jhFuYhmRfwz6ilcLkyMJ15Yi7iG6ssFsO1joBtU5Q1qpzQmFUl9UbV9 9iBe7mE99VzNwi3hMELEM9YuSgAs8st4Itnn8SiHkJ3s6hlmF8N4HwNKfQrseGfb FuJNN4p8Gcu0aF/dkGE8ADJBvtgzkFnavXt0GQPC7SjGOF7rUXxnUQlszNZM0OcK UAfWU06sIyiOholQQt8H8jawT+rGCLomfgPUBVq5K8WByd21IeQeS0upSPeTjxS+ d/C8wzpcbhdNOECwC/wDtgZHvCC95cHNrxuC4+4/Q1KIVVr+1cWqe8hQzFvm3TIg dduEFTQDIxhpE0GO1ZWNf90upzBYBWwIsh4bqsMZS7SpaYIZ6QV45yViZ1w2WfbH m3/F34Z3yqgFuZQrZv4OPo7xHK0+y7uZ60RrhSJtE0X080syRJKBbGmNBRidoVyu JOONWH44I/XN5enZV8StJnqJr9MCV0DBZUCi9ZhP/kAhBjLc5cQ6NByEa9/rebYX 1bLTiA1JDLzDVIan+A8dz0riWmHBvTyBwhLnEXvXb9lcB3ozgHTb7axE5RnZSYLI YQgBOBMFuQKM =YO/Q -----END PGP SIGNATURE----- Merge tag 'pull-qapi-2024-09-10' of https://repo.or.cz/qemu/armbru into staging QAPI patches patches for 2024-09-10 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmbgS0ASHGFybWJydUBy # ZWRoYXQuY29tAAoJEDhwtADrkYZTm+sP/1kEuGdbjjVLQC7U+gCClhALpYUtIMHQ # qNZWmnxFyW9Jx6Lk8+FZBRJegNlmA9AJ2ZzD/2I/WoNtcrNiE53rIRG71Lcy8I6U # CRjekLPn0jhFuYhmRfwz6ilcLkyMJ15Yi7iG6ssFsO1joBtU5Q1qpzQmFUl9UbV9 # 9iBe7mE99VzNwi3hMELEM9YuSgAs8st4Itnn8SiHkJ3s6hlmF8N4HwNKfQrseGfb # FuJNN4p8Gcu0aF/dkGE8ADJBvtgzkFnavXt0GQPC7SjGOF7rUXxnUQlszNZM0OcK # UAfWU06sIyiOholQQt8H8jawT+rGCLomfgPUBVq5K8WByd21IeQeS0upSPeTjxS+ # d/C8wzpcbhdNOECwC/wDtgZHvCC95cHNrxuC4+4/Q1KIVVr+1cWqe8hQzFvm3TIg # dduEFTQDIxhpE0GO1ZWNf90upzBYBWwIsh4bqsMZS7SpaYIZ6QV45yViZ1w2WfbH # m3/F34Z3yqgFuZQrZv4OPo7xHK0+y7uZ60RrhSJtE0X080syRJKBbGmNBRidoVyu # JOONWH44I/XN5enZV8StJnqJr9MCV0DBZUCi9ZhP/kAhBjLc5cQ6NByEa9/rebYX # 1bLTiA1JDLzDVIan+A8dz0riWmHBvTyBwhLnEXvXb9lcB3ozgHTb7axE5RnZSYLI # YQgBOBMFuQKM # =YO/Q # -----END PGP SIGNATURE----- # gpg: Signature made Tue 10 Sep 2024 14:36:00 BST # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * tag 'pull-qapi-2024-09-10' of https://repo.or.cz/qemu/armbru: qapi/vfio: Rename VfioMigrationState to Qapi*, and drop prefix qapi/cryptodev: Rename QCryptodevBackendAlgType to *Algo, and drop prefix qapi/cryptodev: Drop unwanted 'prefix' qapi/crypto: Rename QCryptoAFAlg to QCryptoAFAlgo qapi/crypto: Rename QCryptoRSAPaddingAlgorithm to *Algo, and drop prefix qapi/crypto: Rename QCryptoAkCipherAlgorithm to *Algo, and drop prefix qapi/crypto: Rename QCryptoIVGenAlgorithm to *Algo, and drop prefix qapi/crypto: Rename QCryptoCipherAlgorithm to *Algo, and drop prefix qapi/crypto: Rename QCryptoHashAlgorithm to *Algo, and drop prefix qapi/crypto: Drop unwanted 'prefix' qapi/machine: Rename CpuS390* to S390Cpu*, and drop 'prefix' qapi/ui: Drop temporary 'prefix' qapi/machine: Drop temporary 'prefix' qapi/ebpf: Drop temporary 'prefix' qapi/crypto: Drop temporary 'prefix' qapi/common: Drop temporary 'prefix' qapi/block-core: Drop temporary 'prefix' tests/qapi-schema: Drop temporary 'prefix' qapi: Smarter camel_to_upper() to reduce need for 'prefix' Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
b8eada54b2
|
@ -64,11 +64,11 @@ static void cryptodev_builtin_init_akcipher(CryptoDevBackend *backend)
|
|||
{
|
||||
QCryptoAkCipherOptions opts;
|
||||
|
||||
opts.alg = QCRYPTO_AKCIPHER_ALG_RSA;
|
||||
opts.u.rsa.padding_alg = QCRYPTO_RSA_PADDING_ALG_RAW;
|
||||
opts.alg = QCRYPTO_AK_CIPHER_ALGO_RSA;
|
||||
opts.u.rsa.padding_alg = QCRYPTO_RSA_PADDING_ALGO_RAW;
|
||||
if (qcrypto_akcipher_supports(&opts)) {
|
||||
backend->conf.crypto_services |=
|
||||
(1u << QCRYPTODEV_BACKEND_SERVICE_AKCIPHER);
|
||||
(1u << QCRYPTODEV_BACKEND_SERVICE_TYPE_AKCIPHER);
|
||||
backend->conf.akcipher_algo = 1u << VIRTIO_CRYPTO_AKCIPHER_RSA;
|
||||
}
|
||||
}
|
||||
|
@ -93,9 +93,9 @@ static void cryptodev_builtin_init(
|
|||
backend->conf.peers.ccs[0] = cc;
|
||||
|
||||
backend->conf.crypto_services =
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_CIPHER |
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_HASH |
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_MAC;
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_TYPE_CIPHER |
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_TYPE_HASH |
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_TYPE_MAC;
|
||||
backend->conf.cipher_algo_l = 1u << VIRTIO_CRYPTO_CIPHER_AES_CBC;
|
||||
backend->conf.hash_algo = 1u << VIRTIO_CRYPTO_HASH_SHA1;
|
||||
/*
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -169,16 +169,16 @@ static int cryptodev_builtin_get_rsa_hash_algo(
|
|||
{
|
||||
switch (virtio_rsa_hash) {
|
||||
case VIRTIO_CRYPTO_RSA_MD5:
|
||||
return QCRYPTO_HASH_ALG_MD5;
|
||||
return QCRYPTO_HASH_ALGO_MD5;
|
||||
|
||||
case VIRTIO_CRYPTO_RSA_SHA1:
|
||||
return QCRYPTO_HASH_ALG_SHA1;
|
||||
return QCRYPTO_HASH_ALGO_SHA1;
|
||||
|
||||
case VIRTIO_CRYPTO_RSA_SHA256:
|
||||
return QCRYPTO_HASH_ALG_SHA256;
|
||||
return QCRYPTO_HASH_ALGO_SHA256;
|
||||
|
||||
case VIRTIO_CRYPTO_RSA_SHA512:
|
||||
return QCRYPTO_HASH_ALG_SHA512;
|
||||
return QCRYPTO_HASH_ALGO_SHA512;
|
||||
|
||||
default:
|
||||
error_setg(errp, "Unsupported rsa hash algo: %d", virtio_rsa_hash);
|
||||
|
@ -200,12 +200,12 @@ static int cryptodev_builtin_set_rsa_options(
|
|||
return -1;
|
||||
}
|
||||
opt->hash_alg = hash_alg;
|
||||
opt->padding_alg = QCRYPTO_RSA_PADDING_ALG_PKCS1;
|
||||
opt->padding_alg = QCRYPTO_RSA_PADDING_ALGO_PKCS1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (virtio_padding_algo == VIRTIO_CRYPTO_RSA_RAW_PADDING) {
|
||||
opt->padding_alg = QCRYPTO_RSA_PADDING_ALG_RAW;
|
||||
opt->padding_alg = QCRYPTO_RSA_PADDING_ALGO_RAW;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -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",
|
||||
|
@ -318,7 +318,7 @@ static int cryptodev_builtin_create_akcipher_session(
|
|||
|
||||
switch (sess_info->algo) {
|
||||
case VIRTIO_CRYPTO_AKCIPHER_RSA:
|
||||
opts.alg = QCRYPTO_AKCIPHER_ALG_RSA;
|
||||
opts.alg = QCRYPTO_AK_CIPHER_ALGO_RSA;
|
||||
if (cryptodev_builtin_set_rsa_options(sess_info->u.rsa.padding_algo,
|
||||
sess_info->u.rsa.hash_algo, &opts.u.rsa, errp) != 0) {
|
||||
return -1;
|
||||
|
@ -334,11 +334,11 @@ static int cryptodev_builtin_create_akcipher_session(
|
|||
|
||||
switch (sess_info->keytype) {
|
||||
case VIRTIO_CRYPTO_AKCIPHER_KEY_TYPE_PUBLIC:
|
||||
type = QCRYPTO_AKCIPHER_KEY_TYPE_PUBLIC;
|
||||
type = QCRYPTO_AK_CIPHER_KEY_TYPE_PUBLIC;
|
||||
break;
|
||||
|
||||
case VIRTIO_CRYPTO_AKCIPHER_KEY_TYPE_PRIVATE:
|
||||
type = QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE;
|
||||
type = QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -549,7 +549,7 @@ static int cryptodev_builtin_operation(
|
|||
CryptoDevBackendBuiltinSession *sess;
|
||||
CryptoDevBackendSymOpInfo *sym_op_info;
|
||||
CryptoDevBackendAsymOpInfo *asym_op_info;
|
||||
QCryptodevBackendAlgType algtype = op_info->algtype;
|
||||
QCryptodevBackendAlgoType algtype = op_info->algtype;
|
||||
int status = -VIRTIO_CRYPTO_ERR;
|
||||
Error *local_error = NULL;
|
||||
|
||||
|
@ -561,11 +561,11 @@ static int cryptodev_builtin_operation(
|
|||
}
|
||||
|
||||
sess = builtin->sessions[op_info->session_id];
|
||||
if (algtype == QCRYPTODEV_BACKEND_ALG_SYM) {
|
||||
if (algtype == QCRYPTODEV_BACKEND_ALGO_TYPE_SYM) {
|
||||
sym_op_info = op_info->u.sym_op_info;
|
||||
status = cryptodev_builtin_sym_operation(sess, sym_op_info,
|
||||
&local_error);
|
||||
} else if (algtype == QCRYPTODEV_BACKEND_ALG_ASYM) {
|
||||
} else if (algtype == QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) {
|
||||
asym_op_info = op_info->u.asym_op_info;
|
||||
status = cryptodev_builtin_asym_operation(sess, op_info->op_code,
|
||||
asym_op_info, &local_error);
|
||||
|
|
|
@ -133,20 +133,20 @@ static int cryptodev_lkcf_set_op_desc(QCryptoAkCipherOptions *opts,
|
|||
Error **errp)
|
||||
{
|
||||
QCryptoAkCipherOptionsRSA *rsa_opt;
|
||||
if (opts->alg != QCRYPTO_AKCIPHER_ALG_RSA) {
|
||||
if (opts->alg != QCRYPTO_AK_CIPHER_ALGO_RSA) {
|
||||
error_setg(errp, "Unsupported alg: %u", opts->alg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rsa_opt = &opts->u.rsa;
|
||||
if (rsa_opt->padding_alg == QCRYPTO_RSA_PADDING_ALG_PKCS1) {
|
||||
if (rsa_opt->padding_alg == QCRYPTO_RSA_PADDING_ALGO_PKCS1) {
|
||||
snprintf(key_desc, desc_len, "enc=%s hash=%s",
|
||||
QCryptoRSAPaddingAlgorithm_str(rsa_opt->padding_alg),
|
||||
QCryptoHashAlgorithm_str(rsa_opt->hash_alg));
|
||||
QCryptoRSAPaddingAlgo_str(rsa_opt->padding_alg),
|
||||
QCryptoHashAlgo_str(rsa_opt->hash_alg));
|
||||
|
||||
} else {
|
||||
snprintf(key_desc, desc_len, "enc=%s",
|
||||
QCryptoRSAPaddingAlgorithm_str(rsa_opt->padding_alg));
|
||||
QCryptoRSAPaddingAlgo_str(rsa_opt->padding_alg));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -157,23 +157,23 @@ static int cryptodev_lkcf_set_rsa_opt(int virtio_padding_alg,
|
|||
Error **errp)
|
||||
{
|
||||
if (virtio_padding_alg == VIRTIO_CRYPTO_RSA_PKCS1_PADDING) {
|
||||
opt->padding_alg = QCRYPTO_RSA_PADDING_ALG_PKCS1;
|
||||
opt->padding_alg = QCRYPTO_RSA_PADDING_ALGO_PKCS1;
|
||||
|
||||
switch (virtio_hash_alg) {
|
||||
case VIRTIO_CRYPTO_RSA_MD5:
|
||||
opt->hash_alg = QCRYPTO_HASH_ALG_MD5;
|
||||
opt->hash_alg = QCRYPTO_HASH_ALGO_MD5;
|
||||
break;
|
||||
|
||||
case VIRTIO_CRYPTO_RSA_SHA1:
|
||||
opt->hash_alg = QCRYPTO_HASH_ALG_SHA1;
|
||||
opt->hash_alg = QCRYPTO_HASH_ALGO_SHA1;
|
||||
break;
|
||||
|
||||
case VIRTIO_CRYPTO_RSA_SHA256:
|
||||
opt->hash_alg = QCRYPTO_HASH_ALG_SHA256;
|
||||
opt->hash_alg = QCRYPTO_HASH_ALGO_SHA256;
|
||||
break;
|
||||
|
||||
case VIRTIO_CRYPTO_RSA_SHA512:
|
||||
opt->hash_alg = QCRYPTO_HASH_ALG_SHA512;
|
||||
opt->hash_alg = QCRYPTO_HASH_ALGO_SHA512;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -184,7 +184,7 @@ static int cryptodev_lkcf_set_rsa_opt(int virtio_padding_alg,
|
|||
}
|
||||
|
||||
if (virtio_padding_alg == VIRTIO_CRYPTO_RSA_RAW_PADDING) {
|
||||
opt->padding_alg = QCRYPTO_RSA_PADDING_ALG_RAW;
|
||||
opt->padding_alg = QCRYPTO_RSA_PADDING_ALGO_RAW;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ static void cryptodev_lkcf_init(CryptoDevBackend *backend, Error **errp)
|
|||
backend->conf.peers.ccs[0] = cc;
|
||||
|
||||
backend->conf.crypto_services =
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_AKCIPHER;
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_TYPE_AKCIPHER;
|
||||
backend->conf.akcipher_algo = 1u << VIRTIO_CRYPTO_AKCIPHER_RSA;
|
||||
lkcf->running = true;
|
||||
|
||||
|
@ -322,7 +322,7 @@ static void cryptodev_lkcf_execute_task(CryptoDevLKCFTask *task)
|
|||
* 2. generally, public key related compution is fast, just compute it with
|
||||
* thread-pool.
|
||||
*/
|
||||
if (session->keytype == QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE) {
|
||||
if (session->keytype == QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE) {
|
||||
if (qcrypto_akcipher_export_p8info(&session->akcipher_opts,
|
||||
session->key, session->keylen,
|
||||
&p8info, &p8info_len,
|
||||
|
@ -474,7 +474,7 @@ static int cryptodev_lkcf_operation(
|
|||
CryptoDevBackendLKCF *lkcf =
|
||||
CRYPTODEV_BACKEND_LKCF(backend);
|
||||
CryptoDevBackendLKCFSession *sess;
|
||||
QCryptodevBackendAlgType algtype = op_info->algtype;
|
||||
QCryptodevBackendAlgoType algtype = op_info->algtype;
|
||||
CryptoDevLKCFTask *task;
|
||||
|
||||
if (op_info->session_id >= MAX_SESSIONS ||
|
||||
|
@ -485,7 +485,7 @@ static int cryptodev_lkcf_operation(
|
|||
}
|
||||
|
||||
sess = lkcf->sess[op_info->session_id];
|
||||
if (algtype != QCRYPTODEV_BACKEND_ALG_ASYM) {
|
||||
if (algtype != QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) {
|
||||
error_report("algtype not supported: %u", algtype);
|
||||
return -VIRTIO_CRYPTO_NOTSUPP;
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ static int cryptodev_lkcf_create_asym_session(
|
|||
|
||||
switch (sess_info->algo) {
|
||||
case VIRTIO_CRYPTO_AKCIPHER_RSA:
|
||||
sess->akcipher_opts.alg = QCRYPTO_AKCIPHER_ALG_RSA;
|
||||
sess->akcipher_opts.alg = QCRYPTO_AK_CIPHER_ALGO_RSA;
|
||||
if (cryptodev_lkcf_set_rsa_opt(
|
||||
sess_info->u.rsa.padding_algo, sess_info->u.rsa.hash_algo,
|
||||
&sess->akcipher_opts.u.rsa, &local_error) != 0) {
|
||||
|
@ -534,11 +534,11 @@ static int cryptodev_lkcf_create_asym_session(
|
|||
|
||||
switch (sess_info->keytype) {
|
||||
case VIRTIO_CRYPTO_AKCIPHER_KEY_TYPE_PUBLIC:
|
||||
sess->keytype = QCRYPTO_AKCIPHER_KEY_TYPE_PUBLIC;
|
||||
sess->keytype = QCRYPTO_AK_CIPHER_KEY_TYPE_PUBLIC;
|
||||
break;
|
||||
|
||||
case VIRTIO_CRYPTO_AKCIPHER_KEY_TYPE_PRIVATE:
|
||||
sess->keytype = QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE;
|
||||
sess->keytype = QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -221,9 +221,9 @@ static void cryptodev_vhost_user_init(
|
|||
cryptodev_vhost_user_event, NULL, s, NULL, true);
|
||||
|
||||
backend->conf.crypto_services =
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_CIPHER |
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_HASH |
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_MAC;
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_TYPE_CIPHER |
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_TYPE_HASH |
|
||||
1u << QCRYPTODEV_BACKEND_SERVICE_TYPE_MAC;
|
||||
backend->conf.cipher_algo_l = 1u << VIRTIO_CRYPTO_CIPHER_AES_CBC;
|
||||
backend->conf.hash_algo = 1u << VIRTIO_CRYPTO_HASH_SHA1;
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ static int qmp_query_cryptodev_foreach(Object *obj, void *data)
|
|||
|
||||
backend = CRYPTODEV_BACKEND(obj);
|
||||
services = backend->conf.crypto_services;
|
||||
for (i = 0; i < QCRYPTODEV_BACKEND_SERVICE__MAX; i++) {
|
||||
for (i = 0; i < QCRYPTODEV_BACKEND_SERVICE_TYPE__MAX; i++) {
|
||||
if (services & (1 << i)) {
|
||||
QAPI_LIST_PREPEND(info->service, i);
|
||||
}
|
||||
|
@ -185,10 +185,10 @@ static int cryptodev_backend_operation(
|
|||
static int cryptodev_backend_account(CryptoDevBackend *backend,
|
||||
CryptoDevBackendOpInfo *op_info)
|
||||
{
|
||||
enum QCryptodevBackendAlgType algtype = op_info->algtype;
|
||||
enum QCryptodevBackendAlgoType algtype = op_info->algtype;
|
||||
int len;
|
||||
|
||||
if (algtype == QCRYPTODEV_BACKEND_ALG_ASYM) {
|
||||
if (algtype == QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) {
|
||||
CryptoDevBackendAsymOpInfo *asym_op_info = op_info->u.asym_op_info;
|
||||
len = asym_op_info->src_len;
|
||||
|
||||
|
@ -212,7 +212,7 @@ static int cryptodev_backend_account(CryptoDevBackend *backend,
|
|||
default:
|
||||
return -VIRTIO_CRYPTO_NOTSUPP;
|
||||
}
|
||||
} else if (algtype == QCRYPTODEV_BACKEND_ALG_SYM) {
|
||||
} else if (algtype == QCRYPTODEV_BACKEND_ALGO_TYPE_SYM) {
|
||||
CryptoDevBackendSymOpInfo *sym_op_info = op_info->u.sym_op_info;
|
||||
len = sym_op_info->src_len;
|
||||
|
||||
|
@ -424,11 +424,11 @@ cryptodev_backend_complete(UserCreatable *uc, Error **errp)
|
|||
}
|
||||
|
||||
services = backend->conf.crypto_services;
|
||||
if (services & (1 << QCRYPTODEV_BACKEND_SERVICE_CIPHER)) {
|
||||
if (services & (1 << QCRYPTODEV_BACKEND_SERVICE_TYPE_CIPHER)) {
|
||||
backend->sym_stat = g_new0(CryptodevBackendSymStat, 1);
|
||||
}
|
||||
|
||||
if (services & (1 << QCRYPTODEV_BACKEND_SERVICE_AKCIPHER)) {
|
||||
if (services & (1 << QCRYPTODEV_BACKEND_SERVICE_TYPE_AKCIPHER)) {
|
||||
backend->asym_stat = g_new0(CryptodevBackendAsymStat, 1);
|
||||
}
|
||||
}
|
||||
|
|
6
block.c
6
block.c
|
@ -6351,7 +6351,7 @@ XDbgBlockGraph *bdrv_get_xdbg_block_graph(Error **errp)
|
|||
if (!*name) {
|
||||
name = allocated_name = blk_get_attached_dev_id(blk);
|
||||
}
|
||||
xdbg_graph_add_node(gr, blk, X_DBG_BLOCK_GRAPH_NODE_TYPE_BLOCK_BACKEND,
|
||||
xdbg_graph_add_node(gr, blk, XDBG_BLOCK_GRAPH_NODE_TYPE_BLOCK_BACKEND,
|
||||
name);
|
||||
g_free(allocated_name);
|
||||
if (blk_root(blk)) {
|
||||
|
@ -6364,7 +6364,7 @@ XDbgBlockGraph *bdrv_get_xdbg_block_graph(Error **errp)
|
|||
job = block_job_next_locked(job)) {
|
||||
GSList *el;
|
||||
|
||||
xdbg_graph_add_node(gr, job, X_DBG_BLOCK_GRAPH_NODE_TYPE_BLOCK_JOB,
|
||||
xdbg_graph_add_node(gr, job, XDBG_BLOCK_GRAPH_NODE_TYPE_BLOCK_JOB,
|
||||
job->job.id);
|
||||
for (el = job->nodes; el; el = el->next) {
|
||||
xdbg_graph_add_edge(gr, job, (BdrvChild *)el->data);
|
||||
|
@ -6373,7 +6373,7 @@ XDbgBlockGraph *bdrv_get_xdbg_block_graph(Error **errp)
|
|||
}
|
||||
|
||||
QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) {
|
||||
xdbg_graph_add_node(gr, bs, X_DBG_BLOCK_GRAPH_NODE_TYPE_BLOCK_DRIVER,
|
||||
xdbg_graph_add_node(gr, bs, XDBG_BLOCK_GRAPH_NODE_TYPE_BLOCK_DRIVER,
|
||||
bs->node_name);
|
||||
QLIST_FOREACH(child, &bs->children, next) {
|
||||
xdbg_graph_add_edge(gr, bs, child);
|
||||
|
|
|
@ -682,7 +682,7 @@ err:
|
|||
static int block_crypto_probe_luks(const uint8_t *buf,
|
||||
int buf_size,
|
||||
const char *filename) {
|
||||
return block_crypto_probe_generic(Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
||||
return block_crypto_probe_generic(QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||
buf, buf_size, filename);
|
||||
}
|
||||
|
||||
|
@ -691,7 +691,7 @@ static int block_crypto_open_luks(BlockDriverState *bs,
|
|||
int flags,
|
||||
Error **errp)
|
||||
{
|
||||
return block_crypto_open_generic(Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
||||
return block_crypto_open_generic(QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||
&block_crypto_runtime_opts_luks,
|
||||
bs, options, flags, errp);
|
||||
}
|
||||
|
@ -724,7 +724,7 @@ block_crypto_co_create_luks(BlockdevCreateOptions *create_options, Error **errp)
|
|||
}
|
||||
|
||||
create_opts = (QCryptoBlockCreateOptions) {
|
||||
.format = Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
||||
.format = QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||
.u.luks = *qapi_BlockdevCreateOptionsLUKS_base(luks_opts),
|
||||
};
|
||||
|
||||
|
@ -889,7 +889,7 @@ block_crypto_get_specific_info_luks(BlockDriverState *bs, Error **errp)
|
|||
if (!info) {
|
||||
return NULL;
|
||||
}
|
||||
assert(info->format == Q_CRYPTO_BLOCK_FORMAT_LUKS);
|
||||
assert(info->format == QCRYPTO_BLOCK_FORMAT_LUKS);
|
||||
|
||||
spec_info = g_new(ImageInfoSpecific, 1);
|
||||
spec_info->type = IMAGE_INFO_SPECIFIC_KIND_LUKS;
|
||||
|
@ -1002,7 +1002,7 @@ coroutine_fn block_crypto_co_amend_luks(BlockDriverState *bs,
|
|||
QCryptoBlockAmendOptions amend_opts;
|
||||
|
||||
amend_opts = (QCryptoBlockAmendOptions) {
|
||||
.format = Q_CRYPTO_BLOCK_FORMAT_LUKS,
|
||||
.format = QCRYPTO_BLOCK_FORMAT_LUKS,
|
||||
.u.luks = *qapi_BlockdevAmendOptionsLUKS_base(&opts->u.luks),
|
||||
};
|
||||
return block_crypto_amend_options_generic_luks(bs, &amend_opts,
|
||||
|
|
|
@ -206,7 +206,7 @@ parallels_parse_format_extension(BlockDriverState *bs, uint8_t *ext_cluster,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
ret = qcrypto_hash_bytes(QCRYPTO_HASH_ALG_MD5, (char *)pos, remaining,
|
||||
ret = qcrypto_hash_bytes(QCRYPTO_HASH_ALGO_MD5, (char *)pos, remaining,
|
||||
&hash, &hash_len, errp);
|
||||
if (ret < 0) {
|
||||
goto fail;
|
||||
|
|
|
@ -831,7 +831,7 @@ qcow_co_create(BlockdevCreateOptions *opts, Error **errp)
|
|||
}
|
||||
|
||||
if (qcow_opts->encrypt &&
|
||||
qcow_opts->encrypt->format != Q_CRYPTO_BLOCK_FORMAT_QCOW)
|
||||
qcow_opts->encrypt->format != QCRYPTO_BLOCK_FORMAT_QCOW)
|
||||
{
|
||||
error_setg(errp, "Unsupported encryption format");
|
||||
return -EINVAL;
|
||||
|
|
|
@ -3214,10 +3214,10 @@ qcow2_set_up_encryption(BlockDriverState *bs,
|
|||
int fmt, ret;
|
||||
|
||||
switch (cryptoopts->format) {
|
||||
case Q_CRYPTO_BLOCK_FORMAT_LUKS:
|
||||
case QCRYPTO_BLOCK_FORMAT_LUKS:
|
||||
fmt = QCOW_CRYPT_LUKS;
|
||||
break;
|
||||
case Q_CRYPTO_BLOCK_FORMAT_QCOW:
|
||||
case QCRYPTO_BLOCK_FORMAT_QCOW:
|
||||
fmt = QCOW_CRYPT_AES;
|
||||
break;
|
||||
default:
|
||||
|
@ -5306,10 +5306,10 @@ qcow2_get_specific_info(BlockDriverState *bs, Error **errp)
|
|||
ImageInfoSpecificQCow2Encryption *qencrypt =
|
||||
g_new(ImageInfoSpecificQCow2Encryption, 1);
|
||||
switch (encrypt_info->format) {
|
||||
case Q_CRYPTO_BLOCK_FORMAT_QCOW:
|
||||
case QCRYPTO_BLOCK_FORMAT_QCOW:
|
||||
qencrypt->format = BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_AES;
|
||||
break;
|
||||
case Q_CRYPTO_BLOCK_FORMAT_LUKS:
|
||||
case QCRYPTO_BLOCK_FORMAT_LUKS:
|
||||
qencrypt->format = BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_LUKS;
|
||||
qencrypt->u.luks = encrypt_info->u.luks;
|
||||
break;
|
||||
|
@ -5948,7 +5948,7 @@ static int coroutine_fn qcow2_co_amend(BlockDriverState *bs,
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
if (qopts->encrypt->format != Q_CRYPTO_BLOCK_FORMAT_LUKS) {
|
||||
if (qopts->encrypt->format != QCRYPTO_BLOCK_FORMAT_LUKS) {
|
||||
error_setg(errp,
|
||||
"Amend can't be used to change the qcow2 encryption format");
|
||||
return -EOPNOTSUPP;
|
||||
|
|
|
@ -393,7 +393,7 @@ static int quorum_compute_hash(QuorumAIOCB *acb, int i, QuorumVoteValue *hash)
|
|||
/* XXX - would be nice if we could pass in the Error **
|
||||
* and propagate that back, but this quorum code is
|
||||
* restricted to just errno values currently */
|
||||
if (qcrypto_hash_bytesv(QCRYPTO_HASH_ALG_SHA256,
|
||||
if (qcrypto_hash_bytesv(QCRYPTO_HASH_ALGO_SHA256,
|
||||
qiov->iov, qiov->niov,
|
||||
&data, &len,
|
||||
NULL) < 0) {
|
||||
|
@ -1308,7 +1308,7 @@ static BlockDriver bdrv_quorum = {
|
|||
|
||||
static void bdrv_quorum_init(void)
|
||||
{
|
||||
if (!qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA256)) {
|
||||
if (!qcrypto_hash_supports(QCRYPTO_HASH_ALGO_SHA256)) {
|
||||
/* SHA256 hash support is required for quorum device */
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -367,11 +367,11 @@ static int qemu_rbd_convert_luks_create_options(
|
|||
|
||||
if (luks_opts->has_cipher_alg) {
|
||||
switch (luks_opts->cipher_alg) {
|
||||
case QCRYPTO_CIPHER_ALG_AES_128: {
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128: {
|
||||
*alg = RBD_ENCRYPTION_ALGORITHM_AES128;
|
||||
break;
|
||||
}
|
||||
case QCRYPTO_CIPHER_ALG_AES_256: {
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256: {
|
||||
*alg = RBD_ENCRYPTION_ALGORITHM_AES256;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -66,13 +66,13 @@ qcrypto_afalg_socket_bind(const char *type, const char *name,
|
|||
return sbind;
|
||||
}
|
||||
|
||||
QCryptoAFAlg *
|
||||
QCryptoAFAlgo *
|
||||
qcrypto_afalg_comm_alloc(const char *type, const char *name,
|
||||
Error **errp)
|
||||
{
|
||||
QCryptoAFAlg *afalg;
|
||||
QCryptoAFAlgo *afalg;
|
||||
|
||||
afalg = g_new0(QCryptoAFAlg, 1);
|
||||
afalg = g_new0(QCryptoAFAlgo, 1);
|
||||
/* initialize crypto API socket */
|
||||
afalg->opfd = -1;
|
||||
afalg->tfmfd = qcrypto_afalg_socket_bind(type, name, errp);
|
||||
|
@ -93,7 +93,7 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void qcrypto_afalg_comm_free(QCryptoAFAlg *afalg)
|
||||
void qcrypto_afalg_comm_free(QCryptoAFAlgo *afalg)
|
||||
{
|
||||
if (!afalg) {
|
||||
return;
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
#define ALG_OPTYPE_LEN 4
|
||||
#define ALG_MSGIV_LEN(len) (sizeof(struct af_alg_iv) + (len))
|
||||
|
||||
typedef struct QCryptoAFAlg QCryptoAFAlg;
|
||||
typedef struct QCryptoAFAlgo QCryptoAFAlgo;
|
||||
|
||||
struct QCryptoAFAlg {
|
||||
struct QCryptoAFAlgo {
|
||||
QCryptoCipher base;
|
||||
|
||||
int tfmfd;
|
||||
|
@ -46,22 +46,22 @@ struct QCryptoAFAlg {
|
|||
* @type: the type of crypto operation
|
||||
* @name: the name of crypto operation
|
||||
*
|
||||
* Allocate a QCryptoAFAlg object and bind itself to
|
||||
* Allocate a QCryptoAFAlgo object and bind itself to
|
||||
* a AF_ALG socket.
|
||||
*
|
||||
* Returns:
|
||||
* a new QCryptoAFAlg object, or NULL in error.
|
||||
* a new QCryptoAFAlgo object, or NULL in error.
|
||||
*/
|
||||
QCryptoAFAlg *
|
||||
QCryptoAFAlgo *
|
||||
qcrypto_afalg_comm_alloc(const char *type, const char *name,
|
||||
Error **errp);
|
||||
|
||||
/**
|
||||
* afalg_comm_free:
|
||||
* @afalg: the QCryptoAFAlg object
|
||||
* @afalg: the QCryptoAFAlgo object
|
||||
*
|
||||
* Free the @afalg.
|
||||
*/
|
||||
void qcrypto_afalg_comm_free(QCryptoAFAlg *afalg);
|
||||
void qcrypto_afalg_comm_free(QCryptoAFAlgo *afalg);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,7 +40,7 @@ static void qcrypto_afsplit_xor(size_t blocklen,
|
|||
}
|
||||
|
||||
|
||||
static int qcrypto_afsplit_hash(QCryptoHashAlgorithm hash,
|
||||
static int qcrypto_afsplit_hash(QCryptoHashAlgo hash,
|
||||
size_t blocklen,
|
||||
uint8_t *block,
|
||||
Error **errp)
|
||||
|
@ -85,7 +85,7 @@ static int qcrypto_afsplit_hash(QCryptoHashAlgorithm hash,
|
|||
}
|
||||
|
||||
|
||||
int qcrypto_afsplit_encode(QCryptoHashAlgorithm hash,
|
||||
int qcrypto_afsplit_encode(QCryptoHashAlgo hash,
|
||||
size_t blocklen,
|
||||
uint32_t stripes,
|
||||
const uint8_t *in,
|
||||
|
@ -117,7 +117,7 @@ int qcrypto_afsplit_encode(QCryptoHashAlgorithm hash,
|
|||
}
|
||||
|
||||
|
||||
int qcrypto_afsplit_decode(QCryptoHashAlgorithm hash,
|
||||
int qcrypto_afsplit_decode(QCryptoHashAlgo hash,
|
||||
size_t blocklen,
|
||||
uint32_t stripes,
|
||||
const uint8_t *in,
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
typedef struct QCryptoGcryptRSA {
|
||||
QCryptoAkCipher akcipher;
|
||||
gcry_sexp_t key;
|
||||
QCryptoRSAPaddingAlgorithm padding_alg;
|
||||
QCryptoHashAlgorithm hash_alg;
|
||||
QCryptoRSAPaddingAlgo padding_alg;
|
||||
QCryptoHashAlgo hash_alg;
|
||||
} QCryptoGcryptRSA;
|
||||
|
||||
static void qcrypto_gcrypt_rsa_free(QCryptoAkCipher *akcipher)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -85,7 +85,7 @@ static int qcrypto_gcrypt_parse_rsa_private_key(
|
|||
const uint8_t *key, size_t keylen, Error **errp)
|
||||
{
|
||||
g_autoptr(QCryptoAkCipherRSAKey) rsa_key = qcrypto_akcipher_rsakey_parse(
|
||||
QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE, key, keylen, errp);
|
||||
QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE, key, keylen, errp);
|
||||
gcry_mpi_t n = NULL, e = NULL, d = NULL, p = NULL, q = NULL, u = NULL;
|
||||
bool compute_mul_inv = false;
|
||||
int ret = -1;
|
||||
|
@ -178,7 +178,7 @@ static int qcrypto_gcrypt_parse_rsa_public_key(QCryptoGcryptRSA *rsa,
|
|||
{
|
||||
|
||||
g_autoptr(QCryptoAkCipherRSAKey) rsa_key = qcrypto_akcipher_rsakey_parse(
|
||||
QCRYPTO_AKCIPHER_KEY_TYPE_PUBLIC, key, keylen, errp);
|
||||
QCRYPTO_AK_CIPHER_KEY_TYPE_PUBLIC, key, keylen, errp);
|
||||
gcry_mpi_t n = NULL, e = NULL;
|
||||
int ret = -1;
|
||||
gcry_error_t err;
|
||||
|
@ -241,7 +241,7 @@ static int qcrypto_gcrypt_rsa_encrypt(QCryptoAkCipher *akcipher,
|
|||
|
||||
err = gcry_sexp_build(&data_sexp, NULL,
|
||||
"(data (flags %s) (value %b))",
|
||||
QCryptoRSAPaddingAlgorithm_str(rsa->padding_alg),
|
||||
QCryptoRSAPaddingAlgo_str(rsa->padding_alg),
|
||||
in_len, in);
|
||||
if (gcry_err_code(err) != 0) {
|
||||
error_setg(errp, "Failed to build plaintext: %s/%s",
|
||||
|
@ -263,7 +263,7 @@ static int qcrypto_gcrypt_rsa_encrypt(QCryptoAkCipher *akcipher,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
if (rsa->padding_alg == QCRYPTO_RSA_PADDING_ALG_RAW) {
|
||||
if (rsa->padding_alg == QCRYPTO_RSA_PADDING_ALGO_RAW) {
|
||||
cipher_mpi = gcry_sexp_nth_mpi(cipher_sexp_item, 1, GCRYMPI_FMT_USG);
|
||||
if (!cipher_mpi) {
|
||||
error_setg(errp, "Invalid ciphertext result");
|
||||
|
@ -332,7 +332,7 @@ static int qcrypto_gcrypt_rsa_decrypt(QCryptoAkCipher *akcipher,
|
|||
|
||||
err = gcry_sexp_build(&cipher_sexp, NULL,
|
||||
"(enc-val (flags %s) (rsa (a %b) ))",
|
||||
QCryptoRSAPaddingAlgorithm_str(rsa->padding_alg),
|
||||
QCryptoRSAPaddingAlgo_str(rsa->padding_alg),
|
||||
in_len, in);
|
||||
if (gcry_err_code(err) != 0) {
|
||||
error_setg(errp, "Failed to build ciphertext: %s/%s",
|
||||
|
@ -348,7 +348,7 @@ static int qcrypto_gcrypt_rsa_decrypt(QCryptoAkCipher *akcipher,
|
|||
}
|
||||
|
||||
/* S-expression of plaintext: (value plaintext) */
|
||||
if (rsa->padding_alg == QCRYPTO_RSA_PADDING_ALG_RAW) {
|
||||
if (rsa->padding_alg == QCRYPTO_RSA_PADDING_ALGO_RAW) {
|
||||
data_mpi = gcry_sexp_nth_mpi(data_sexp, 1, GCRYMPI_FMT_USG);
|
||||
if (!data_mpi) {
|
||||
error_setg(errp, "Invalid plaintext result");
|
||||
|
@ -410,14 +410,14 @@ static int qcrypto_gcrypt_rsa_sign(QCryptoAkCipher *akcipher,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (rsa->padding_alg != QCRYPTO_RSA_PADDING_ALG_PKCS1) {
|
||||
if (rsa->padding_alg != QCRYPTO_RSA_PADDING_ALGO_PKCS1) {
|
||||
error_setg(errp, "Invalid padding %u", rsa->padding_alg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
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",
|
||||
|
@ -482,7 +482,7 @@ static int qcrypto_gcrypt_rsa_verify(QCryptoAkCipher *akcipher,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (rsa->padding_alg != QCRYPTO_RSA_PADDING_ALG_PKCS1) {
|
||||
if (rsa->padding_alg != QCRYPTO_RSA_PADDING_ALGO_PKCS1) {
|
||||
error_setg(errp, "Invalid padding %u", rsa->padding_alg);
|
||||
return ret;
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -540,13 +540,13 @@ static QCryptoGcryptRSA *qcrypto_gcrypt_rsa_new(
|
|||
rsa->akcipher.driver = &gcrypt_rsa;
|
||||
|
||||
switch (type) {
|
||||
case QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE:
|
||||
case QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE:
|
||||
if (qcrypto_gcrypt_parse_rsa_private_key(rsa, key, keylen, errp) != 0) {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
||||
case QCRYPTO_AKCIPHER_KEY_TYPE_PUBLIC:
|
||||
case QCRYPTO_AK_CIPHER_KEY_TYPE_PUBLIC:
|
||||
if (qcrypto_gcrypt_parse_rsa_public_key(rsa, key, keylen, errp) != 0) {
|
||||
goto error;
|
||||
}
|
||||
|
@ -568,17 +568,17 @@ 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:
|
||||
case QCRYPTO_RSA_PADDING_ALGO_RAW:
|
||||
return true;
|
||||
|
||||
case QCRYPTO_RSA_PADDING_ALG_PKCS1:
|
||||
case QCRYPTO_RSA_PADDING_ALGO_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:
|
||||
|
|
|
@ -33,8 +33,8 @@ typedef struct QCryptoNettleRSA {
|
|||
QCryptoAkCipher akcipher;
|
||||
struct rsa_public_key pub;
|
||||
struct rsa_private_key priv;
|
||||
QCryptoRSAPaddingAlgorithm padding_alg;
|
||||
QCryptoHashAlgorithm hash_alg;
|
||||
QCryptoRSAPaddingAlgo padding_alg;
|
||||
QCryptoHashAlgo hash_alg;
|
||||
} QCryptoNettleRSA;
|
||||
|
||||
static void qcrypto_nettle_rsa_free(QCryptoAkCipher *akcipher)
|
||||
|
@ -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:
|
||||
|
@ -87,7 +87,7 @@ static int qcrypt_nettle_parse_rsa_private_key(QCryptoNettleRSA *rsa,
|
|||
Error **errp)
|
||||
{
|
||||
g_autoptr(QCryptoAkCipherRSAKey) rsa_key = qcrypto_akcipher_rsakey_parse(
|
||||
QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE, key, keylen, errp);
|
||||
QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE, key, keylen, errp);
|
||||
|
||||
if (!rsa_key) {
|
||||
return -1;
|
||||
|
@ -137,7 +137,7 @@ static int qcrypt_nettle_parse_rsa_public_key(QCryptoNettleRSA *rsa,
|
|||
Error **errp)
|
||||
{
|
||||
g_autoptr(QCryptoAkCipherRSAKey) rsa_key = qcrypto_akcipher_rsakey_parse(
|
||||
QCRYPTO_AKCIPHER_KEY_TYPE_PUBLIC, key, keylen, errp);
|
||||
QCRYPTO_AK_CIPHER_KEY_TYPE_PUBLIC, key, keylen, errp);
|
||||
|
||||
if (!rsa_key) {
|
||||
return -1;
|
||||
|
@ -184,11 +184,11 @@ static int qcrypto_nettle_rsa_encrypt(QCryptoAkCipher *akcipher,
|
|||
|
||||
/* Nettle do not support RSA encryption without any padding */
|
||||
switch (rsa->padding_alg) {
|
||||
case QCRYPTO_RSA_PADDING_ALG_RAW:
|
||||
case QCRYPTO_RSA_PADDING_ALGO_RAW:
|
||||
error_setg(errp, "RSA with raw padding is not supported");
|
||||
break;
|
||||
|
||||
case QCRYPTO_RSA_PADDING_ALG_PKCS1:
|
||||
case QCRYPTO_RSA_PADDING_ALGO_PKCS1:
|
||||
mpz_init(c);
|
||||
if (rsa_encrypt(&rsa->pub, NULL, wrap_nettle_random_func,
|
||||
data_len, (uint8_t *)data, c) != 1) {
|
||||
|
@ -223,11 +223,11 @@ static int qcrypto_nettle_rsa_decrypt(QCryptoAkCipher *akcipher,
|
|||
}
|
||||
|
||||
switch (rsa->padding_alg) {
|
||||
case QCRYPTO_RSA_PADDING_ALG_RAW:
|
||||
case QCRYPTO_RSA_PADDING_ALGO_RAW:
|
||||
error_setg(errp, "RSA with raw padding is not supported");
|
||||
break;
|
||||
|
||||
case QCRYPTO_RSA_PADDING_ALG_PKCS1:
|
||||
case QCRYPTO_RSA_PADDING_ALGO_PKCS1:
|
||||
nettle_mpz_init_set_str_256_u(c, enc_len, enc);
|
||||
if (!rsa_decrypt(&rsa->priv, &data_len, (uint8_t *)data, c)) {
|
||||
error_setg(errp, "Failed to decrypt");
|
||||
|
@ -257,7 +257,7 @@ static int qcrypto_nettle_rsa_sign(QCryptoAkCipher *akcipher,
|
|||
* The RSA algorithm cannot be used for signature/verification
|
||||
* without padding.
|
||||
*/
|
||||
if (rsa->padding_alg == QCRYPTO_RSA_PADDING_ALG_RAW) {
|
||||
if (rsa->padding_alg == QCRYPTO_RSA_PADDING_ALGO_RAW) {
|
||||
error_setg(errp, "Try to make signature without padding");
|
||||
return ret;
|
||||
}
|
||||
|
@ -276,19 +276,19 @@ static int qcrypto_nettle_rsa_sign(QCryptoAkCipher *akcipher,
|
|||
|
||||
mpz_init(s);
|
||||
switch (rsa->hash_alg) {
|
||||
case QCRYPTO_HASH_ALG_MD5:
|
||||
case QCRYPTO_HASH_ALGO_MD5:
|
||||
rv = rsa_md5_sign_digest(&rsa->priv, data, s);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA1:
|
||||
case QCRYPTO_HASH_ALGO_SHA1:
|
||||
rv = rsa_sha1_sign_digest(&rsa->priv, data, s);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA256:
|
||||
case QCRYPTO_HASH_ALGO_SHA256:
|
||||
rv = rsa_sha256_sign_digest(&rsa->priv, data, s);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA512:
|
||||
case QCRYPTO_HASH_ALGO_SHA512:
|
||||
rv = rsa_sha512_sign_digest(&rsa->priv, data, s);
|
||||
break;
|
||||
|
||||
|
@ -324,7 +324,7 @@ static int qcrypto_nettle_rsa_verify(QCryptoAkCipher *akcipher,
|
|||
* The RSA algorithm cannot be used for signature/verification
|
||||
* without padding.
|
||||
*/
|
||||
if (rsa->padding_alg == QCRYPTO_RSA_PADDING_ALG_RAW) {
|
||||
if (rsa->padding_alg == QCRYPTO_RSA_PADDING_ALGO_RAW) {
|
||||
error_setg(errp, "Try to verify signature without padding");
|
||||
return ret;
|
||||
}
|
||||
|
@ -341,19 +341,19 @@ static int qcrypto_nettle_rsa_verify(QCryptoAkCipher *akcipher,
|
|||
|
||||
nettle_mpz_init_set_str_256_u(s, sig_len, sig);
|
||||
switch (rsa->hash_alg) {
|
||||
case QCRYPTO_HASH_ALG_MD5:
|
||||
case QCRYPTO_HASH_ALGO_MD5:
|
||||
rv = rsa_md5_verify_digest(&rsa->pub, data, s);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA1:
|
||||
case QCRYPTO_HASH_ALGO_SHA1:
|
||||
rv = rsa_sha1_verify_digest(&rsa->pub, data, s);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA256:
|
||||
case QCRYPTO_HASH_ALGO_SHA256:
|
||||
rv = rsa_sha256_verify_digest(&rsa->pub, data, s);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA512:
|
||||
case QCRYPTO_HASH_ALGO_SHA512:
|
||||
rv = rsa_sha512_verify_digest(&rsa->pub, data, s);
|
||||
break;
|
||||
|
||||
|
@ -397,13 +397,13 @@ static QCryptoAkCipher *qcrypto_nettle_rsa_new(
|
|||
rsa_private_key_init(&rsa->priv);
|
||||
|
||||
switch (type) {
|
||||
case QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE:
|
||||
case QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE:
|
||||
if (qcrypt_nettle_parse_rsa_private_key(rsa, key, keylen, errp) != 0) {
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
||||
case QCRYPTO_AKCIPHER_KEY_TYPE_PUBLIC:
|
||||
case QCRYPTO_AK_CIPHER_KEY_TYPE_PUBLIC:
|
||||
if (qcrypt_nettle_parse_rsa_public_key(rsa, key, keylen, errp) != 0) {
|
||||
goto error;
|
||||
}
|
||||
|
@ -425,21 +425,21 @@ 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:
|
||||
case QCRYPTO_RSA_PADDING_ALGO_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:
|
||||
return false;
|
||||
}
|
||||
|
||||
case QCRYPTO_RSA_PADDING_ALG_RAW:
|
||||
case QCRYPTO_RSA_PADDING_ALGO_RAW:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -68,38 +68,38 @@ struct QCryptoBlockLUKSCipherNameMap {
|
|||
|
||||
static const QCryptoBlockLUKSCipherSizeMap
|
||||
qcrypto_block_luks_cipher_size_map_aes[] = {
|
||||
{ 16, QCRYPTO_CIPHER_ALG_AES_128 },
|
||||
{ 24, QCRYPTO_CIPHER_ALG_AES_192 },
|
||||
{ 32, QCRYPTO_CIPHER_ALG_AES_256 },
|
||||
{ 16, QCRYPTO_CIPHER_ALGO_AES_128 },
|
||||
{ 24, QCRYPTO_CIPHER_ALGO_AES_192 },
|
||||
{ 32, QCRYPTO_CIPHER_ALGO_AES_256 },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
static const QCryptoBlockLUKSCipherSizeMap
|
||||
qcrypto_block_luks_cipher_size_map_cast5[] = {
|
||||
{ 16, QCRYPTO_CIPHER_ALG_CAST5_128 },
|
||||
{ 16, QCRYPTO_CIPHER_ALGO_CAST5_128 },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
static const QCryptoBlockLUKSCipherSizeMap
|
||||
qcrypto_block_luks_cipher_size_map_serpent[] = {
|
||||
{ 16, QCRYPTO_CIPHER_ALG_SERPENT_128 },
|
||||
{ 24, QCRYPTO_CIPHER_ALG_SERPENT_192 },
|
||||
{ 32, QCRYPTO_CIPHER_ALG_SERPENT_256 },
|
||||
{ 16, QCRYPTO_CIPHER_ALGO_SERPENT_128 },
|
||||
{ 24, QCRYPTO_CIPHER_ALGO_SERPENT_192 },
|
||||
{ 32, QCRYPTO_CIPHER_ALGO_SERPENT_256 },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
static const QCryptoBlockLUKSCipherSizeMap
|
||||
qcrypto_block_luks_cipher_size_map_twofish[] = {
|
||||
{ 16, QCRYPTO_CIPHER_ALG_TWOFISH_128 },
|
||||
{ 24, QCRYPTO_CIPHER_ALG_TWOFISH_192 },
|
||||
{ 32, QCRYPTO_CIPHER_ALG_TWOFISH_256 },
|
||||
{ 16, QCRYPTO_CIPHER_ALGO_TWOFISH_128 },
|
||||
{ 24, QCRYPTO_CIPHER_ALGO_TWOFISH_192 },
|
||||
{ 32, QCRYPTO_CIPHER_ALGO_TWOFISH_256 },
|
||||
{ 0, 0 },
|
||||
};
|
||||
|
||||
#ifdef CONFIG_CRYPTO_SM4
|
||||
static const QCryptoBlockLUKSCipherSizeMap
|
||||
qcrypto_block_luks_cipher_size_map_sm4[] = {
|
||||
{ 16, QCRYPTO_CIPHER_ALG_SM4},
|
||||
{ 16, QCRYPTO_CIPHER_ALGO_SM4},
|
||||
{ 0, 0 },
|
||||
};
|
||||
#endif
|
||||
|
@ -123,25 +123,25 @@ struct QCryptoBlockLUKS {
|
|||
QCryptoBlockLUKSHeader header;
|
||||
|
||||
/* Main encryption algorithm used for encryption*/
|
||||
QCryptoCipherAlgorithm cipher_alg;
|
||||
QCryptoCipherAlgo cipher_alg;
|
||||
|
||||
/* Mode of encryption for the selected encryption algorithm */
|
||||
QCryptoCipherMode cipher_mode;
|
||||
|
||||
/* Initialization vector generation algorithm */
|
||||
QCryptoIVGenAlgorithm ivgen_alg;
|
||||
QCryptoIVGenAlgo ivgen_alg;
|
||||
|
||||
/* Hash algorithm used for IV generation*/
|
||||
QCryptoHashAlgorithm ivgen_hash_alg;
|
||||
QCryptoHashAlgo ivgen_hash_alg;
|
||||
|
||||
/*
|
||||
* Encryption algorithm used for IV generation.
|
||||
* Usually the same as main encryption algorithm
|
||||
*/
|
||||
QCryptoCipherAlgorithm ivgen_cipher_alg;
|
||||
QCryptoCipherAlgo ivgen_cipher_alg;
|
||||
|
||||
/* Hash algorithm used in pbkdf2 function */
|
||||
QCryptoHashAlgorithm hash_alg;
|
||||
QCryptoHashAlgo hash_alg;
|
||||
|
||||
/* Name of the secret that was used to open the image */
|
||||
char *secret;
|
||||
|
@ -179,7 +179,7 @@ static int qcrypto_block_luks_cipher_name_lookup(const char *name,
|
|||
}
|
||||
|
||||
static const char *
|
||||
qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgorithm alg,
|
||||
qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgo alg,
|
||||
Error **errp)
|
||||
{
|
||||
const QCryptoBlockLUKSCipherNameMap *map =
|
||||
|
@ -195,7 +195,7 @@ qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgorithm alg,
|
|||
}
|
||||
|
||||
error_setg(errp, "Algorithm '%s' not supported",
|
||||
QCryptoCipherAlgorithm_str(alg));
|
||||
QCryptoCipherAlgo_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -223,13 +223,13 @@ static int qcrypto_block_luks_name_lookup(const char *name,
|
|||
|
||||
#define qcrypto_block_luks_hash_name_lookup(name, errp) \
|
||||
qcrypto_block_luks_name_lookup(name, \
|
||||
&QCryptoHashAlgorithm_lookup, \
|
||||
&QCryptoHashAlgo_lookup, \
|
||||
"Hash algorithm", \
|
||||
errp)
|
||||
|
||||
#define qcrypto_block_luks_ivgen_name_lookup(name, errp) \
|
||||
qcrypto_block_luks_name_lookup(name, \
|
||||
&QCryptoIVGenAlgorithm_lookup, \
|
||||
&QCryptoIVGenAlgo_lookup, \
|
||||
"IV generator", \
|
||||
errp)
|
||||
|
||||
|
@ -262,9 +262,9 @@ qcrypto_block_luks_has_format(const uint8_t *buf,
|
|||
* the cipher since that gets a key length matching the digest
|
||||
* size, not AES 128 with truncated digest as might be imagined
|
||||
*/
|
||||
static QCryptoCipherAlgorithm
|
||||
qcrypto_block_luks_essiv_cipher(QCryptoCipherAlgorithm cipher,
|
||||
QCryptoHashAlgorithm hash,
|
||||
static QCryptoCipherAlgo
|
||||
qcrypto_block_luks_essiv_cipher(QCryptoCipherAlgo cipher,
|
||||
QCryptoHashAlgo hash,
|
||||
Error **errp)
|
||||
{
|
||||
size_t digestlen = qcrypto_hash_digest_len(hash);
|
||||
|
@ -274,54 +274,54 @@ qcrypto_block_luks_essiv_cipher(QCryptoCipherAlgorithm cipher,
|
|||
}
|
||||
|
||||
switch (cipher) {
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALG_AES_192:
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_192:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
if (digestlen == qcrypto_cipher_get_key_len(
|
||||
QCRYPTO_CIPHER_ALG_AES_128)) {
|
||||
return QCRYPTO_CIPHER_ALG_AES_128;
|
||||
QCRYPTO_CIPHER_ALGO_AES_128)) {
|
||||
return QCRYPTO_CIPHER_ALGO_AES_128;
|
||||
} else if (digestlen == qcrypto_cipher_get_key_len(
|
||||
QCRYPTO_CIPHER_ALG_AES_192)) {
|
||||
return QCRYPTO_CIPHER_ALG_AES_192;
|
||||
QCRYPTO_CIPHER_ALGO_AES_192)) {
|
||||
return QCRYPTO_CIPHER_ALGO_AES_192;
|
||||
} else if (digestlen == qcrypto_cipher_get_key_len(
|
||||
QCRYPTO_CIPHER_ALG_AES_256)) {
|
||||
return QCRYPTO_CIPHER_ALG_AES_256;
|
||||
QCRYPTO_CIPHER_ALGO_AES_256)) {
|
||||
return QCRYPTO_CIPHER_ALGO_AES_256;
|
||||
} else {
|
||||
error_setg(errp, "No AES cipher with key size %zu available",
|
||||
digestlen);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_256:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_256:
|
||||
if (digestlen == qcrypto_cipher_get_key_len(
|
||||
QCRYPTO_CIPHER_ALG_SERPENT_128)) {
|
||||
return QCRYPTO_CIPHER_ALG_SERPENT_128;
|
||||
QCRYPTO_CIPHER_ALGO_SERPENT_128)) {
|
||||
return QCRYPTO_CIPHER_ALGO_SERPENT_128;
|
||||
} else if (digestlen == qcrypto_cipher_get_key_len(
|
||||
QCRYPTO_CIPHER_ALG_SERPENT_192)) {
|
||||
return QCRYPTO_CIPHER_ALG_SERPENT_192;
|
||||
QCRYPTO_CIPHER_ALGO_SERPENT_192)) {
|
||||
return QCRYPTO_CIPHER_ALGO_SERPENT_192;
|
||||
} else if (digestlen == qcrypto_cipher_get_key_len(
|
||||
QCRYPTO_CIPHER_ALG_SERPENT_256)) {
|
||||
return QCRYPTO_CIPHER_ALG_SERPENT_256;
|
||||
QCRYPTO_CIPHER_ALGO_SERPENT_256)) {
|
||||
return QCRYPTO_CIPHER_ALGO_SERPENT_256;
|
||||
} else {
|
||||
error_setg(errp, "No Serpent cipher with key size %zu available",
|
||||
digestlen);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_192:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_256:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_192:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_256:
|
||||
if (digestlen == qcrypto_cipher_get_key_len(
|
||||
QCRYPTO_CIPHER_ALG_TWOFISH_128)) {
|
||||
return QCRYPTO_CIPHER_ALG_TWOFISH_128;
|
||||
QCRYPTO_CIPHER_ALGO_TWOFISH_128)) {
|
||||
return QCRYPTO_CIPHER_ALGO_TWOFISH_128;
|
||||
} else if (digestlen == qcrypto_cipher_get_key_len(
|
||||
QCRYPTO_CIPHER_ALG_TWOFISH_192)) {
|
||||
return QCRYPTO_CIPHER_ALG_TWOFISH_192;
|
||||
QCRYPTO_CIPHER_ALGO_TWOFISH_192)) {
|
||||
return QCRYPTO_CIPHER_ALGO_TWOFISH_192;
|
||||
} else if (digestlen == qcrypto_cipher_get_key_len(
|
||||
QCRYPTO_CIPHER_ALG_TWOFISH_256)) {
|
||||
return QCRYPTO_CIPHER_ALG_TWOFISH_256;
|
||||
QCRYPTO_CIPHER_ALGO_TWOFISH_256)) {
|
||||
return QCRYPTO_CIPHER_ALGO_TWOFISH_256;
|
||||
} else {
|
||||
error_setg(errp, "No Twofish cipher with key size %zu available",
|
||||
digestlen);
|
||||
|
@ -330,7 +330,7 @@ qcrypto_block_luks_essiv_cipher(QCryptoCipherAlgorithm cipher,
|
|||
break;
|
||||
default:
|
||||
error_setg(errp, "Cipher %s not supported with essiv",
|
||||
QCryptoCipherAlgorithm_str(cipher));
|
||||
QCryptoCipherAlgo_str(cipher));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ qcrypto_block_luks_parse_header(QCryptoBlockLUKS *luks, Error **errp)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (luks->ivgen_alg == QCRYPTO_IVGEN_ALG_ESSIV) {
|
||||
if (luks->ivgen_alg == QCRYPTO_IV_GEN_ALGO_ESSIV) {
|
||||
if (!ivhash_name) {
|
||||
error_setg(errp, "Missing IV generator hash specification");
|
||||
return -1;
|
||||
|
@ -1322,20 +1322,20 @@ qcrypto_block_luks_create(QCryptoBlock *block,
|
|||
luks_opts.iter_time = QCRYPTO_BLOCK_LUKS_DEFAULT_ITER_TIME_MS;
|
||||
}
|
||||
if (!luks_opts.has_cipher_alg) {
|
||||
luks_opts.cipher_alg = QCRYPTO_CIPHER_ALG_AES_256;
|
||||
luks_opts.cipher_alg = QCRYPTO_CIPHER_ALGO_AES_256;
|
||||
}
|
||||
if (!luks_opts.has_cipher_mode) {
|
||||
luks_opts.cipher_mode = QCRYPTO_CIPHER_MODE_XTS;
|
||||
}
|
||||
if (!luks_opts.has_ivgen_alg) {
|
||||
luks_opts.ivgen_alg = QCRYPTO_IVGEN_ALG_PLAIN64;
|
||||
luks_opts.ivgen_alg = QCRYPTO_IV_GEN_ALGO_PLAIN64;
|
||||
}
|
||||
if (!luks_opts.has_hash_alg) {
|
||||
luks_opts.hash_alg = QCRYPTO_HASH_ALG_SHA256;
|
||||
luks_opts.hash_alg = QCRYPTO_HASH_ALGO_SHA256;
|
||||
}
|
||||
if (luks_opts.ivgen_alg == QCRYPTO_IVGEN_ALG_ESSIV) {
|
||||
if (luks_opts.ivgen_alg == QCRYPTO_IV_GEN_ALGO_ESSIV) {
|
||||
if (!luks_opts.has_ivgen_hash_alg) {
|
||||
luks_opts.ivgen_hash_alg = QCRYPTO_HASH_ALG_SHA256;
|
||||
luks_opts.ivgen_hash_alg = QCRYPTO_HASH_ALGO_SHA256;
|
||||
luks_opts.has_ivgen_hash_alg = true;
|
||||
}
|
||||
}
|
||||
|
@ -1384,15 +1384,15 @@ qcrypto_block_luks_create(QCryptoBlock *block,
|
|||
}
|
||||
|
||||
cipher_mode = QCryptoCipherMode_str(luks_opts.cipher_mode);
|
||||
ivgen_alg = QCryptoIVGenAlgorithm_str(luks_opts.ivgen_alg);
|
||||
ivgen_alg = QCryptoIVGenAlgo_str(luks_opts.ivgen_alg);
|
||||
if (luks_opts.has_ivgen_hash_alg) {
|
||||
ivgen_hash_alg = QCryptoHashAlgorithm_str(luks_opts.ivgen_hash_alg);
|
||||
ivgen_hash_alg = QCryptoHashAlgo_str(luks_opts.ivgen_hash_alg);
|
||||
cipher_mode_spec = g_strdup_printf("%s-%s:%s", cipher_mode, ivgen_alg,
|
||||
ivgen_hash_alg);
|
||||
} else {
|
||||
cipher_mode_spec = g_strdup_printf("%s-%s", cipher_mode, ivgen_alg);
|
||||
}
|
||||
hash_alg = QCryptoHashAlgorithm_str(luks_opts.hash_alg);
|
||||
hash_alg = QCryptoHashAlgo_str(luks_opts.hash_alg);
|
||||
|
||||
|
||||
if (strlen(cipher_alg) >= QCRYPTO_BLOCK_LUKS_CIPHER_NAME_LEN) {
|
||||
|
@ -1411,7 +1411,7 @@ qcrypto_block_luks_create(QCryptoBlock *block,
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (luks_opts.ivgen_alg == QCRYPTO_IVGEN_ALG_ESSIV) {
|
||||
if (luks_opts.ivgen_alg == QCRYPTO_IV_GEN_ALGO_ESSIV) {
|
||||
luks->ivgen_cipher_alg =
|
||||
qcrypto_block_luks_essiv_cipher(luks_opts.cipher_alg,
|
||||
luks_opts.ivgen_hash_alg,
|
||||
|
@ -1861,11 +1861,11 @@ qcrypto_block_luks_amend_options(QCryptoBlock *block,
|
|||
QCryptoBlockAmendOptionsLUKS *opts_luks = &options->u.luks;
|
||||
|
||||
switch (opts_luks->state) {
|
||||
case Q_CRYPTO_BLOCKLUKS_KEYSLOT_STATE_ACTIVE:
|
||||
case QCRYPTO_BLOCK_LUKS_KEYSLOT_STATE_ACTIVE:
|
||||
return qcrypto_block_luks_amend_add_keyslot(block, readfunc,
|
||||
writefunc, opaque,
|
||||
opts_luks, force, errp);
|
||||
case Q_CRYPTO_BLOCKLUKS_KEYSLOT_STATE_INACTIVE:
|
||||
case QCRYPTO_BLOCK_LUKS_KEYSLOT_STATE_INACTIVE:
|
||||
return qcrypto_block_luks_amend_erase_keyslots(block, readfunc,
|
||||
writefunc, opaque,
|
||||
opts_luks, force, errp);
|
||||
|
@ -1886,7 +1886,7 @@ static int qcrypto_block_luks_get_info(QCryptoBlock *block,
|
|||
info->u.luks.cipher_alg = luks->cipher_alg;
|
||||
info->u.luks.cipher_mode = luks->cipher_mode;
|
||||
info->u.luks.ivgen_alg = luks->ivgen_alg;
|
||||
if (info->u.luks.ivgen_alg == QCRYPTO_IVGEN_ALG_ESSIV) {
|
||||
if (info->u.luks.ivgen_alg == QCRYPTO_IV_GEN_ALGO_ESSIV) {
|
||||
info->u.luks.has_ivgen_hash_alg = true;
|
||||
info->u.luks.ivgen_hash_alg = luks->ivgen_hash_alg;
|
||||
}
|
||||
|
|
|
@ -62,16 +62,16 @@ qcrypto_block_qcow_init(QCryptoBlock *block,
|
|||
memcpy(keybuf, password, MIN(len, sizeof(keybuf)));
|
||||
g_free(password);
|
||||
|
||||
block->niv = qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALG_AES_128,
|
||||
block->niv = qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALGO_AES_128,
|
||||
QCRYPTO_CIPHER_MODE_CBC);
|
||||
block->ivgen = qcrypto_ivgen_new(QCRYPTO_IVGEN_ALG_PLAIN64,
|
||||
block->ivgen = qcrypto_ivgen_new(QCRYPTO_IV_GEN_ALGO_PLAIN64,
|
||||
0, 0, NULL, 0, errp);
|
||||
if (!block->ivgen) {
|
||||
ret = -ENOTSUP;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = qcrypto_block_init_cipher(block, QCRYPTO_CIPHER_ALG_AES_128,
|
||||
ret = qcrypto_block_init_cipher(block, QCRYPTO_CIPHER_ALGO_AES_128,
|
||||
QCRYPTO_CIPHER_MODE_CBC,
|
||||
keybuf, G_N_ELEMENTS(keybuf),
|
||||
errp);
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
#include "block-luks.h"
|
||||
|
||||
static const QCryptoBlockDriver *qcrypto_block_drivers[] = {
|
||||
[Q_CRYPTO_BLOCK_FORMAT_QCOW] = &qcrypto_block_driver_qcow,
|
||||
[Q_CRYPTO_BLOCK_FORMAT_LUKS] = &qcrypto_block_driver_luks,
|
||||
[QCRYPTO_BLOCK_FORMAT_QCOW] = &qcrypto_block_driver_qcow,
|
||||
[QCRYPTO_BLOCK_FORMAT_LUKS] = &qcrypto_block_driver_luks,
|
||||
};
|
||||
|
||||
|
||||
|
@ -267,7 +267,7 @@ static void qcrypto_block_push_cipher(QCryptoBlock *block,
|
|||
|
||||
|
||||
int qcrypto_block_init_cipher(QCryptoBlock *block,
|
||||
QCryptoCipherAlgorithm alg,
|
||||
QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp)
|
||||
|
@ -332,7 +332,7 @@ QCryptoIVGen *qcrypto_block_get_ivgen(QCryptoBlock *block)
|
|||
}
|
||||
|
||||
|
||||
QCryptoHashAlgorithm qcrypto_block_get_kdf_hash(QCryptoBlock *block)
|
||||
QCryptoHashAlgo qcrypto_block_get_kdf_hash(QCryptoBlock *block)
|
||||
{
|
||||
return block->kdfhash;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ struct QCryptoBlock {
|
|||
void *opaque;
|
||||
|
||||
/* Cipher parameters */
|
||||
QCryptoCipherAlgorithm alg;
|
||||
QCryptoCipherAlgo alg;
|
||||
QCryptoCipherMode mode;
|
||||
uint8_t *key;
|
||||
size_t nkey;
|
||||
|
@ -44,7 +44,7 @@ struct QCryptoBlock {
|
|||
QCryptoIVGen *ivgen;
|
||||
QemuMutex mutex;
|
||||
|
||||
QCryptoHashAlgorithm kdfhash;
|
||||
QCryptoHashAlgo kdfhash;
|
||||
size_t niv;
|
||||
uint64_t payload_offset; /* In bytes */
|
||||
uint64_t sector_size; /* In bytes */
|
||||
|
@ -132,7 +132,7 @@ int qcrypto_block_encrypt_helper(QCryptoBlock *block,
|
|||
Error **errp);
|
||||
|
||||
int qcrypto_block_init_cipher(QCryptoBlock *block,
|
||||
QCryptoCipherAlgorithm alg,
|
||||
QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
|
||||
static char *
|
||||
qcrypto_afalg_cipher_format_name(QCryptoCipherAlgorithm alg,
|
||||
qcrypto_afalg_cipher_format_name(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -27,22 +27,22 @@ qcrypto_afalg_cipher_format_name(QCryptoCipherAlgorithm alg,
|
|||
const char *mode_name;
|
||||
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALG_AES_192:
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_192:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
alg_name = "aes";
|
||||
break;
|
||||
case QCRYPTO_CIPHER_ALG_CAST5_128:
|
||||
case QCRYPTO_CIPHER_ALGO_CAST5_128:
|
||||
alg_name = "cast5";
|
||||
break;
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_256:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_256:
|
||||
alg_name = "serpent";
|
||||
break;
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_192:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_256:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_192:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_256:
|
||||
alg_name = "twofish";
|
||||
break;
|
||||
|
||||
|
@ -60,12 +60,12 @@ qcrypto_afalg_cipher_format_name(QCryptoCipherAlgorithm alg,
|
|||
static const struct QCryptoCipherDriver qcrypto_cipher_afalg_driver;
|
||||
|
||||
QCryptoCipher *
|
||||
qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
const uint8_t *key,
|
||||
size_t nkey, Error **errp)
|
||||
{
|
||||
QCryptoAFAlg *afalg;
|
||||
QCryptoAFAlgo *afalg;
|
||||
size_t expect_niv;
|
||||
char *name;
|
||||
|
||||
|
@ -119,7 +119,7 @@ qcrypto_afalg_cipher_setiv(QCryptoCipher *cipher,
|
|||
const uint8_t *iv,
|
||||
size_t niv, Error **errp)
|
||||
{
|
||||
QCryptoAFAlg *afalg = container_of(cipher, QCryptoAFAlg, base);
|
||||
QCryptoAFAlgo *afalg = container_of(cipher, QCryptoAFAlgo, base);
|
||||
struct af_alg_iv *alg_iv;
|
||||
size_t expect_niv;
|
||||
|
||||
|
@ -143,7 +143,7 @@ qcrypto_afalg_cipher_setiv(QCryptoCipher *cipher,
|
|||
}
|
||||
|
||||
static int
|
||||
qcrypto_afalg_cipher_op(QCryptoAFAlg *afalg,
|
||||
qcrypto_afalg_cipher_op(QCryptoAFAlgo *afalg,
|
||||
const void *in, void *out,
|
||||
size_t len, bool do_encrypt,
|
||||
Error **errp)
|
||||
|
@ -202,7 +202,7 @@ qcrypto_afalg_cipher_encrypt(QCryptoCipher *cipher,
|
|||
const void *in, void *out,
|
||||
size_t len, Error **errp)
|
||||
{
|
||||
QCryptoAFAlg *afalg = container_of(cipher, QCryptoAFAlg, base);
|
||||
QCryptoAFAlgo *afalg = container_of(cipher, QCryptoAFAlgo, base);
|
||||
|
||||
return qcrypto_afalg_cipher_op(afalg, in, out, len, true, errp);
|
||||
}
|
||||
|
@ -212,14 +212,14 @@ qcrypto_afalg_cipher_decrypt(QCryptoCipher *cipher,
|
|||
const void *in, void *out,
|
||||
size_t len, Error **errp)
|
||||
{
|
||||
QCryptoAFAlg *afalg = container_of(cipher, QCryptoAFAlg, base);
|
||||
QCryptoAFAlgo *afalg = container_of(cipher, QCryptoAFAlgo, base);
|
||||
|
||||
return qcrypto_afalg_cipher_op(afalg, in, out, len, false, errp);
|
||||
}
|
||||
|
||||
static void qcrypto_afalg_comm_ctx_free(QCryptoCipher *cipher)
|
||||
{
|
||||
QCryptoAFAlg *afalg = container_of(cipher, QCryptoAFAlg, base);
|
||||
QCryptoAFAlgo *afalg = container_of(cipher, QCryptoAFAlgo, base);
|
||||
|
||||
qcrypto_afalg_comm_free(afalg);
|
||||
}
|
||||
|
|
|
@ -221,13 +221,13 @@ static const struct QCryptoCipherDriver qcrypto_cipher_aes_driver_cbc = {
|
|||
.cipher_free = qcrypto_cipher_ctx_free,
|
||||
};
|
||||
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode)
|
||||
{
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALG_AES_192:
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_192:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
switch (mode) {
|
||||
case QCRYPTO_CIPHER_MODE_ECB:
|
||||
case QCRYPTO_CIPHER_MODE_CBC:
|
||||
|
@ -241,7 +241,7 @@ bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
|
|||
}
|
||||
}
|
||||
|
||||
static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
const uint8_t *key,
|
||||
size_t nkey,
|
||||
|
@ -252,9 +252,9 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
}
|
||||
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALG_AES_192:
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_192:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
{
|
||||
QCryptoCipherBuiltinAES *ctx;
|
||||
const QCryptoCipherDriver *drv;
|
||||
|
@ -292,7 +292,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
default:
|
||||
error_setg(errp,
|
||||
"Unsupported cipher algorithm %s",
|
||||
QCryptoCipherAlgorithm_str(alg));
|
||||
QCryptoCipherAlgo_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,33 +20,33 @@
|
|||
|
||||
#include <gcrypt.h>
|
||||
|
||||
static int qcrypto_cipher_alg_to_gcry_alg(QCryptoCipherAlgorithm alg)
|
||||
static int qcrypto_cipher_alg_to_gcry_alg(QCryptoCipherAlgo alg)
|
||||
{
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_DES:
|
||||
case QCRYPTO_CIPHER_ALGO_DES:
|
||||
return GCRY_CIPHER_DES;
|
||||
case QCRYPTO_CIPHER_ALG_3DES:
|
||||
case QCRYPTO_CIPHER_ALGO_3DES:
|
||||
return GCRY_CIPHER_3DES;
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
return GCRY_CIPHER_AES128;
|
||||
case QCRYPTO_CIPHER_ALG_AES_192:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_192:
|
||||
return GCRY_CIPHER_AES192;
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
return GCRY_CIPHER_AES256;
|
||||
case QCRYPTO_CIPHER_ALG_CAST5_128:
|
||||
case QCRYPTO_CIPHER_ALGO_CAST5_128:
|
||||
return GCRY_CIPHER_CAST5;
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_128:
|
||||
return GCRY_CIPHER_SERPENT128;
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_192:
|
||||
return GCRY_CIPHER_SERPENT192;
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_256:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_256:
|
||||
return GCRY_CIPHER_SERPENT256;
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_128:
|
||||
return GCRY_CIPHER_TWOFISH128;
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_256:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_256:
|
||||
return GCRY_CIPHER_TWOFISH;
|
||||
#ifdef CONFIG_CRYPTO_SM4
|
||||
case QCRYPTO_CIPHER_ALG_SM4:
|
||||
case QCRYPTO_CIPHER_ALGO_SM4:
|
||||
return GCRY_CIPHER_SM4;
|
||||
#endif
|
||||
default:
|
||||
|
@ -70,23 +70,23 @@ static int qcrypto_cipher_mode_to_gcry_mode(QCryptoCipherMode mode)
|
|||
}
|
||||
}
|
||||
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode)
|
||||
{
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_DES:
|
||||
case QCRYPTO_CIPHER_ALG_3DES:
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALG_AES_192:
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALG_CAST5_128:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_256:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_256:
|
||||
case QCRYPTO_CIPHER_ALGO_DES:
|
||||
case QCRYPTO_CIPHER_ALGO_3DES:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_192:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_CAST5_128:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_256:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_256:
|
||||
#ifdef CONFIG_CRYPTO_SM4
|
||||
case QCRYPTO_CIPHER_ALG_SM4:
|
||||
case QCRYPTO_CIPHER_ALGO_SM4:
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
@ -228,7 +228,7 @@ static const struct QCryptoCipherDriver qcrypto_gcrypt_ctr_driver = {
|
|||
.cipher_free = qcrypto_gcrypt_ctx_free,
|
||||
};
|
||||
|
||||
static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
const uint8_t *key,
|
||||
size_t nkey,
|
||||
|
@ -246,7 +246,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
gcryalg = qcrypto_cipher_alg_to_gcry_alg(alg);
|
||||
if (gcryalg == GCRY_CIPHER_NONE) {
|
||||
error_setg(errp, "Unsupported cipher algorithm %s",
|
||||
QCryptoCipherAlgorithm_str(alg));
|
||||
QCryptoCipherAlgo_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define QEMU_GNUTLS_XTS
|
||||
#endif
|
||||
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode)
|
||||
{
|
||||
|
||||
|
@ -35,11 +35,11 @@ bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
|
|||
case QCRYPTO_CIPHER_MODE_ECB:
|
||||
case QCRYPTO_CIPHER_MODE_CBC:
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALG_AES_192:
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALG_DES:
|
||||
case QCRYPTO_CIPHER_ALG_3DES:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_192:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_DES:
|
||||
case QCRYPTO_CIPHER_ALGO_3DES:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -47,8 +47,8 @@ bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
|
|||
#ifdef QEMU_GNUTLS_XTS
|
||||
case QCRYPTO_CIPHER_MODE_XTS:
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -229,7 +229,7 @@ static struct QCryptoCipherDriver gnutls_driver = {
|
|||
.cipher_free = qcrypto_gnutls_cipher_free,
|
||||
};
|
||||
|
||||
static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
const uint8_t *key,
|
||||
size_t nkey,
|
||||
|
@ -244,10 +244,10 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
#ifdef QEMU_GNUTLS_XTS
|
||||
case QCRYPTO_CIPHER_MODE_XTS:
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
galg = GNUTLS_CIPHER_AES_128_XTS;
|
||||
break;
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
galg = GNUTLS_CIPHER_AES_256_XTS;
|
||||
break;
|
||||
default:
|
||||
|
@ -259,19 +259,19 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
case QCRYPTO_CIPHER_MODE_ECB:
|
||||
case QCRYPTO_CIPHER_MODE_CBC:
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
galg = GNUTLS_CIPHER_AES_128_CBC;
|
||||
break;
|
||||
case QCRYPTO_CIPHER_ALG_AES_192:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_192:
|
||||
galg = GNUTLS_CIPHER_AES_192_CBC;
|
||||
break;
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
galg = GNUTLS_CIPHER_AES_256_CBC;
|
||||
break;
|
||||
case QCRYPTO_CIPHER_ALG_DES:
|
||||
case QCRYPTO_CIPHER_ALGO_DES:
|
||||
galg = GNUTLS_CIPHER_DES_CBC;
|
||||
break;
|
||||
case QCRYPTO_CIPHER_ALG_3DES:
|
||||
case QCRYPTO_CIPHER_ALGO_3DES:
|
||||
galg = GNUTLS_CIPHER_3DES_CBC;
|
||||
break;
|
||||
default:
|
||||
|
@ -284,7 +284,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
|
||||
if (galg == GNUTLS_CIPHER_UNKNOWN) {
|
||||
error_setg(errp, "Unsupported cipher algorithm %s with %s mode",
|
||||
QCryptoCipherAlgorithm_str(alg),
|
||||
QCryptoCipherAlgo_str(alg),
|
||||
QCryptoCipherMode_str(mode));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -310,8 +310,8 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
}
|
||||
}
|
||||
|
||||
if (alg == QCRYPTO_CIPHER_ALG_DES ||
|
||||
alg == QCRYPTO_CIPHER_ALG_3DES)
|
||||
if (alg == QCRYPTO_CIPHER_ALGO_DES ||
|
||||
alg == QCRYPTO_CIPHER_ALGO_3DES)
|
||||
ctx->blocksize = 8;
|
||||
else
|
||||
ctx->blocksize = 16;
|
||||
|
|
|
@ -454,24 +454,24 @@ DEFINE_ECB(qcrypto_nettle_sm4,
|
|||
sm4_encrypt_native, sm4_decrypt_native)
|
||||
#endif
|
||||
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
|
||||
bool qcrypto_cipher_supports(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode)
|
||||
{
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_DES:
|
||||
case QCRYPTO_CIPHER_ALG_3DES:
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALG_AES_192:
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALG_CAST5_128:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_256:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_192:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_256:
|
||||
case QCRYPTO_CIPHER_ALGO_DES:
|
||||
case QCRYPTO_CIPHER_ALGO_3DES:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_192:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_CAST5_128:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_256:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_192:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_256:
|
||||
#ifdef CONFIG_CRYPTO_SM4
|
||||
case QCRYPTO_CIPHER_ALG_SM4:
|
||||
case QCRYPTO_CIPHER_ALGO_SM4:
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
@ -489,7 +489,7 @@ bool qcrypto_cipher_supports(QCryptoCipherAlgorithm alg,
|
|||
}
|
||||
}
|
||||
|
||||
static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
const uint8_t *key,
|
||||
size_t nkey,
|
||||
|
@ -510,7 +510,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
}
|
||||
|
||||
switch (alg) {
|
||||
case QCRYPTO_CIPHER_ALG_DES:
|
||||
case QCRYPTO_CIPHER_ALGO_DES:
|
||||
{
|
||||
QCryptoNettleDES *ctx;
|
||||
const QCryptoCipherDriver *drv;
|
||||
|
@ -538,7 +538,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
return &ctx->base;
|
||||
}
|
||||
|
||||
case QCRYPTO_CIPHER_ALG_3DES:
|
||||
case QCRYPTO_CIPHER_ALGO_3DES:
|
||||
{
|
||||
QCryptoNettleDES3 *ctx;
|
||||
const QCryptoCipherDriver *drv;
|
||||
|
@ -565,7 +565,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
return &ctx->base;
|
||||
}
|
||||
|
||||
case QCRYPTO_CIPHER_ALG_AES_128:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_128:
|
||||
{
|
||||
QCryptoNettleAES128 *ctx = g_new0(QCryptoNettleAES128, 1);
|
||||
|
||||
|
@ -594,7 +594,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
return &ctx->base;
|
||||
}
|
||||
|
||||
case QCRYPTO_CIPHER_ALG_AES_192:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_192:
|
||||
{
|
||||
QCryptoNettleAES192 *ctx = g_new0(QCryptoNettleAES192, 1);
|
||||
|
||||
|
@ -623,7 +623,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
return &ctx->base;
|
||||
}
|
||||
|
||||
case QCRYPTO_CIPHER_ALG_AES_256:
|
||||
case QCRYPTO_CIPHER_ALGO_AES_256:
|
||||
{
|
||||
QCryptoNettleAES256 *ctx = g_new0(QCryptoNettleAES256, 1);
|
||||
|
||||
|
@ -652,7 +652,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
return &ctx->base;
|
||||
}
|
||||
|
||||
case QCRYPTO_CIPHER_ALG_CAST5_128:
|
||||
case QCRYPTO_CIPHER_ALGO_CAST5_128:
|
||||
{
|
||||
QCryptoNettleCAST128 *ctx;
|
||||
const QCryptoCipherDriver *drv;
|
||||
|
@ -680,9 +680,9 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
return &ctx->base;
|
||||
}
|
||||
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALG_SERPENT_256:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_128:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_192:
|
||||
case QCRYPTO_CIPHER_ALGO_SERPENT_256:
|
||||
{
|
||||
QCryptoNettleSerpent *ctx = g_new0(QCryptoNettleSerpent, 1);
|
||||
|
||||
|
@ -709,9 +709,9 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
return &ctx->base;
|
||||
}
|
||||
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_192:
|
||||
case QCRYPTO_CIPHER_ALG_TWOFISH_256:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_128:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_192:
|
||||
case QCRYPTO_CIPHER_ALGO_TWOFISH_256:
|
||||
{
|
||||
QCryptoNettleTwofish *ctx = g_new0(QCryptoNettleTwofish, 1);
|
||||
|
||||
|
@ -738,7 +738,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
return &ctx->base;
|
||||
}
|
||||
#ifdef CONFIG_CRYPTO_SM4
|
||||
case QCRYPTO_CIPHER_ALG_SM4:
|
||||
case QCRYPTO_CIPHER_ALGO_SM4:
|
||||
{
|
||||
QCryptoNettleSm4 *ctx;
|
||||
const QCryptoCipherDriver *drv;
|
||||
|
@ -766,7 +766,7 @@ static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
|||
|
||||
default:
|
||||
error_setg(errp, "Unsupported cipher algorithm %s",
|
||||
QCryptoCipherAlgorithm_str(alg));
|
||||
QCryptoCipherAlgo_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,39 +25,39 @@
|
|||
#include "cipherpriv.h"
|
||||
|
||||
|
||||
static const size_t alg_key_len[QCRYPTO_CIPHER_ALG__MAX] = {
|
||||
[QCRYPTO_CIPHER_ALG_AES_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_AES_192] = 24,
|
||||
[QCRYPTO_CIPHER_ALG_AES_256] = 32,
|
||||
[QCRYPTO_CIPHER_ALG_DES] = 8,
|
||||
[QCRYPTO_CIPHER_ALG_3DES] = 24,
|
||||
[QCRYPTO_CIPHER_ALG_CAST5_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_SERPENT_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_SERPENT_192] = 24,
|
||||
[QCRYPTO_CIPHER_ALG_SERPENT_256] = 32,
|
||||
[QCRYPTO_CIPHER_ALG_TWOFISH_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_TWOFISH_192] = 24,
|
||||
[QCRYPTO_CIPHER_ALG_TWOFISH_256] = 32,
|
||||
static const size_t alg_key_len[QCRYPTO_CIPHER_ALGO__MAX] = {
|
||||
[QCRYPTO_CIPHER_ALGO_AES_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_AES_192] = 24,
|
||||
[QCRYPTO_CIPHER_ALGO_AES_256] = 32,
|
||||
[QCRYPTO_CIPHER_ALGO_DES] = 8,
|
||||
[QCRYPTO_CIPHER_ALGO_3DES] = 24,
|
||||
[QCRYPTO_CIPHER_ALGO_CAST5_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_SERPENT_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_SERPENT_192] = 24,
|
||||
[QCRYPTO_CIPHER_ALGO_SERPENT_256] = 32,
|
||||
[QCRYPTO_CIPHER_ALGO_TWOFISH_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_TWOFISH_192] = 24,
|
||||
[QCRYPTO_CIPHER_ALGO_TWOFISH_256] = 32,
|
||||
#ifdef CONFIG_CRYPTO_SM4
|
||||
[QCRYPTO_CIPHER_ALG_SM4] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_SM4] = 16,
|
||||
#endif
|
||||
};
|
||||
|
||||
static const size_t alg_block_len[QCRYPTO_CIPHER_ALG__MAX] = {
|
||||
[QCRYPTO_CIPHER_ALG_AES_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_AES_192] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_AES_256] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_DES] = 8,
|
||||
[QCRYPTO_CIPHER_ALG_3DES] = 8,
|
||||
[QCRYPTO_CIPHER_ALG_CAST5_128] = 8,
|
||||
[QCRYPTO_CIPHER_ALG_SERPENT_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_SERPENT_192] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_SERPENT_256] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_TWOFISH_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_TWOFISH_192] = 16,
|
||||
[QCRYPTO_CIPHER_ALG_TWOFISH_256] = 16,
|
||||
static const size_t alg_block_len[QCRYPTO_CIPHER_ALGO__MAX] = {
|
||||
[QCRYPTO_CIPHER_ALGO_AES_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_AES_192] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_AES_256] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_DES] = 8,
|
||||
[QCRYPTO_CIPHER_ALGO_3DES] = 8,
|
||||
[QCRYPTO_CIPHER_ALGO_CAST5_128] = 8,
|
||||
[QCRYPTO_CIPHER_ALGO_SERPENT_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_SERPENT_192] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_SERPENT_256] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_TWOFISH_128] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_TWOFISH_192] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_TWOFISH_256] = 16,
|
||||
#ifdef CONFIG_CRYPTO_SM4
|
||||
[QCRYPTO_CIPHER_ALG_SM4] = 16,
|
||||
[QCRYPTO_CIPHER_ALGO_SM4] = 16,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -69,21 +69,21 @@ static const bool mode_need_iv[QCRYPTO_CIPHER_MODE__MAX] = {
|
|||
};
|
||||
|
||||
|
||||
size_t qcrypto_cipher_get_block_len(QCryptoCipherAlgorithm alg)
|
||||
size_t qcrypto_cipher_get_block_len(QCryptoCipherAlgo alg)
|
||||
{
|
||||
assert(alg < G_N_ELEMENTS(alg_key_len));
|
||||
return alg_block_len[alg];
|
||||
}
|
||||
|
||||
|
||||
size_t qcrypto_cipher_get_key_len(QCryptoCipherAlgorithm alg)
|
||||
size_t qcrypto_cipher_get_key_len(QCryptoCipherAlgo alg)
|
||||
{
|
||||
assert(alg < G_N_ELEMENTS(alg_key_len));
|
||||
return alg_key_len[alg];
|
||||
}
|
||||
|
||||
|
||||
size_t qcrypto_cipher_get_iv_len(QCryptoCipherAlgorithm alg,
|
||||
size_t qcrypto_cipher_get_iv_len(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode)
|
||||
{
|
||||
if (alg >= G_N_ELEMENTS(alg_block_len)) {
|
||||
|
@ -101,20 +101,20 @@ size_t qcrypto_cipher_get_iv_len(QCryptoCipherAlgorithm alg,
|
|||
|
||||
|
||||
static bool
|
||||
qcrypto_cipher_validate_key_length(QCryptoCipherAlgorithm alg,
|
||||
qcrypto_cipher_validate_key_length(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
size_t nkey,
|
||||
Error **errp)
|
||||
{
|
||||
if ((unsigned)alg >= QCRYPTO_CIPHER_ALG__MAX) {
|
||||
if ((unsigned)alg >= QCRYPTO_CIPHER_ALGO__MAX) {
|
||||
error_setg(errp, "Cipher algorithm %d out of range",
|
||||
alg);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mode == QCRYPTO_CIPHER_MODE_XTS) {
|
||||
if (alg == QCRYPTO_CIPHER_ALG_DES ||
|
||||
alg == QCRYPTO_CIPHER_ALG_3DES) {
|
||||
if (alg == QCRYPTO_CIPHER_ALGO_DES ||
|
||||
alg == QCRYPTO_CIPHER_ALGO_3DES) {
|
||||
error_setg(errp, "XTS mode not compatible with DES/3DES");
|
||||
return false;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ qcrypto_cipher_validate_key_length(QCryptoCipherAlgorithm alg,
|
|||
#include "cipher-builtin.c.inc"
|
||||
#endif
|
||||
|
||||
QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgorithm alg,
|
||||
QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp)
|
||||
|
|
|
@ -42,7 +42,7 @@ struct QCryptoCipherDriver {
|
|||
#include "afalgpriv.h"
|
||||
|
||||
extern QCryptoCipher *
|
||||
qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgo alg,
|
||||
QCryptoCipherMode mode,
|
||||
const uint8_t *key,
|
||||
size_t nkey, Error **errp);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -64,12 +64,12 @@ qcrypto_afalg_hash_format_name(QCryptoHashAlgorithm alg,
|
|||
return name;
|
||||
}
|
||||
|
||||
static QCryptoAFAlg *
|
||||
qcrypto_afalg_hash_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
static QCryptoAFAlgo *
|
||||
qcrypto_afalg_hash_hmac_ctx_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
bool is_hmac, Error **errp)
|
||||
{
|
||||
QCryptoAFAlg *afalg;
|
||||
QCryptoAFAlgo *afalg;
|
||||
char *name;
|
||||
|
||||
name = qcrypto_afalg_hash_format_name(alg, is_hmac, errp);
|
||||
|
@ -98,15 +98,15 @@ qcrypto_afalg_hash_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
|||
return afalg;
|
||||
}
|
||||
|
||||
static QCryptoAFAlg *
|
||||
qcrypto_afalg_hash_ctx_new(QCryptoHashAlgorithm alg,
|
||||
static QCryptoAFAlgo *
|
||||
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,
|
||||
QCryptoAFAlgo *
|
||||
qcrypto_afalg_hmac_ctx_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -114,14 +114,14 @@ qcrypto_afalg_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
|||
}
|
||||
|
||||
static int
|
||||
qcrypto_afalg_hash_hmac_bytesv(QCryptoAFAlg *hmac,
|
||||
QCryptoHashAlgorithm alg,
|
||||
qcrypto_afalg_hash_hmac_bytesv(QCryptoAFAlgo *hmac,
|
||||
QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov, uint8_t **result,
|
||||
size_t *resultlen,
|
||||
Error **errp)
|
||||
{
|
||||
QCryptoAFAlg *afalg;
|
||||
QCryptoAFAlgo *afalg;
|
||||
struct iovec outv;
|
||||
int ret = 0;
|
||||
bool is_hmac = (hmac != NULL) ? true : false;
|
||||
|
@ -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,
|
||||
|
@ -197,7 +197,7 @@ qcrypto_afalg_hmac_bytesv(QCryptoHmac *hmac,
|
|||
|
||||
static void qcrypto_afalg_hmac_ctx_free(QCryptoHmac *hmac)
|
||||
{
|
||||
QCryptoAFAlg *afalg;
|
||||
QCryptoAFAlgo *afalg;
|
||||
|
||||
afalg = hmac->opaque;
|
||||
qcrypto_afalg_comm_free(afalg);
|
||||
|
|
|
@ -25,17 +25,17 @@
|
|||
#include "hashpriv.h"
|
||||
|
||||
|
||||
static int qcrypto_hash_alg_map[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = GCRY_MD_MD5,
|
||||
[QCRYPTO_HASH_ALG_SHA1] = GCRY_MD_SHA1,
|
||||
[QCRYPTO_HASH_ALG_SHA224] = GCRY_MD_SHA224,
|
||||
[QCRYPTO_HASH_ALG_SHA256] = GCRY_MD_SHA256,
|
||||
[QCRYPTO_HASH_ALG_SHA384] = GCRY_MD_SHA384,
|
||||
[QCRYPTO_HASH_ALG_SHA512] = GCRY_MD_SHA512,
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = GCRY_MD_RMD160,
|
||||
static int qcrypto_hash_alg_map[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = GCRY_MD_MD5,
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = GCRY_MD_SHA1,
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = GCRY_MD_SHA224,
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = GCRY_MD_SHA256,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = GCRY_MD_SHA384,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = GCRY_MD_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = GCRY_MD_RMD160,
|
||||
};
|
||||
|
||||
gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg)
|
||||
gboolean qcrypto_hash_supports(QCryptoHashAlgo alg)
|
||||
{
|
||||
if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map) &&
|
||||
qcrypto_hash_alg_map[alg] != GCRY_MD_NONE) {
|
||||
|
@ -46,7 +46,7 @@ gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg)
|
|||
|
||||
|
||||
static int
|
||||
qcrypto_gcrypt_hash_bytesv(QCryptoHashAlgorithm alg,
|
||||
qcrypto_gcrypt_hash_bytesv(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
uint8_t **result,
|
||||
|
|
|
@ -24,17 +24,17 @@
|
|||
#include "hashpriv.h"
|
||||
|
||||
|
||||
static int qcrypto_hash_alg_map[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = G_CHECKSUM_MD5,
|
||||
[QCRYPTO_HASH_ALG_SHA1] = G_CHECKSUM_SHA1,
|
||||
[QCRYPTO_HASH_ALG_SHA224] = -1,
|
||||
[QCRYPTO_HASH_ALG_SHA256] = G_CHECKSUM_SHA256,
|
||||
[QCRYPTO_HASH_ALG_SHA384] = G_CHECKSUM_SHA384,
|
||||
[QCRYPTO_HASH_ALG_SHA512] = G_CHECKSUM_SHA512,
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = -1,
|
||||
static int qcrypto_hash_alg_map[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = G_CHECKSUM_MD5,
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = G_CHECKSUM_SHA1,
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = -1,
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = G_CHECKSUM_SHA256,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = G_CHECKSUM_SHA384,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = G_CHECKSUM_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = -1,
|
||||
};
|
||||
|
||||
gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg)
|
||||
gboolean qcrypto_hash_supports(QCryptoHashAlgo alg)
|
||||
{
|
||||
if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map) &&
|
||||
qcrypto_hash_alg_map[alg] != -1) {
|
||||
|
@ -45,7 +45,7 @@ gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg)
|
|||
|
||||
|
||||
static int
|
||||
qcrypto_glib_hash_bytesv(QCryptoHashAlgorithm alg,
|
||||
qcrypto_glib_hash_bytesv(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
uint8_t **result,
|
||||
|
|
|
@ -25,17 +25,17 @@
|
|||
#include "hashpriv.h"
|
||||
|
||||
|
||||
static int qcrypto_hash_alg_map[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = GNUTLS_DIG_MD5,
|
||||
[QCRYPTO_HASH_ALG_SHA1] = GNUTLS_DIG_SHA1,
|
||||
[QCRYPTO_HASH_ALG_SHA224] = GNUTLS_DIG_SHA224,
|
||||
[QCRYPTO_HASH_ALG_SHA256] = GNUTLS_DIG_SHA256,
|
||||
[QCRYPTO_HASH_ALG_SHA384] = GNUTLS_DIG_SHA384,
|
||||
[QCRYPTO_HASH_ALG_SHA512] = GNUTLS_DIG_SHA512,
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = GNUTLS_DIG_RMD160,
|
||||
static int qcrypto_hash_alg_map[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = GNUTLS_DIG_MD5,
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = GNUTLS_DIG_SHA1,
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = GNUTLS_DIG_SHA224,
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = GNUTLS_DIG_SHA256,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = GNUTLS_DIG_SHA384,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = GNUTLS_DIG_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = GNUTLS_DIG_RMD160,
|
||||
};
|
||||
|
||||
gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg)
|
||||
gboolean qcrypto_hash_supports(QCryptoHashAlgo alg)
|
||||
{
|
||||
size_t i;
|
||||
const gnutls_digest_algorithm_t *algs;
|
||||
|
@ -54,7 +54,7 @@ gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg)
|
|||
|
||||
|
||||
static int
|
||||
qcrypto_gnutls_hash_bytesv(QCryptoHashAlgorithm alg,
|
||||
qcrypto_gnutls_hash_bytesv(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
uint8_t **result,
|
||||
|
|
|
@ -50,43 +50,43 @@ struct qcrypto_hash_alg {
|
|||
qcrypto_nettle_result result;
|
||||
size_t len;
|
||||
} qcrypto_hash_alg_map[] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = {
|
||||
.init = (qcrypto_nettle_init)md5_init,
|
||||
.write = (qcrypto_nettle_write)md5_update,
|
||||
.result = (qcrypto_nettle_result)md5_digest,
|
||||
.len = MD5_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_SHA1] = {
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = {
|
||||
.init = (qcrypto_nettle_init)sha1_init,
|
||||
.write = (qcrypto_nettle_write)sha1_update,
|
||||
.result = (qcrypto_nettle_result)sha1_digest,
|
||||
.len = SHA1_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_SHA224] = {
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = {
|
||||
.init = (qcrypto_nettle_init)sha224_init,
|
||||
.write = (qcrypto_nettle_write)sha224_update,
|
||||
.result = (qcrypto_nettle_result)sha224_digest,
|
||||
.len = SHA224_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_SHA256] = {
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = {
|
||||
.init = (qcrypto_nettle_init)sha256_init,
|
||||
.write = (qcrypto_nettle_write)sha256_update,
|
||||
.result = (qcrypto_nettle_result)sha256_digest,
|
||||
.len = SHA256_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_SHA384] = {
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = {
|
||||
.init = (qcrypto_nettle_init)sha384_init,
|
||||
.write = (qcrypto_nettle_write)sha384_update,
|
||||
.result = (qcrypto_nettle_result)sha384_digest,
|
||||
.len = SHA384_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_SHA512] = {
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = {
|
||||
.init = (qcrypto_nettle_init)sha512_init,
|
||||
.write = (qcrypto_nettle_write)sha512_update,
|
||||
.result = (qcrypto_nettle_result)sha512_digest,
|
||||
.len = SHA512_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = {
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = {
|
||||
.init = (qcrypto_nettle_init)ripemd160_init,
|
||||
.write = (qcrypto_nettle_write)ripemd160_update,
|
||||
.result = (qcrypto_nettle_result)ripemd160_digest,
|
||||
|
@ -94,7 +94,7 @@ struct qcrypto_hash_alg {
|
|||
},
|
||||
};
|
||||
|
||||
gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg)
|
||||
gboolean qcrypto_hash_supports(QCryptoHashAlgo alg)
|
||||
{
|
||||
if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map) &&
|
||||
qcrypto_hash_alg_map[alg].init != NULL) {
|
||||
|
@ -105,7 +105,7 @@ gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg)
|
|||
|
||||
|
||||
static int
|
||||
qcrypto_nettle_hash_bytesv(QCryptoHashAlgorithm alg,
|
||||
qcrypto_nettle_hash_bytesv(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
uint8_t **result,
|
||||
|
|
|
@ -22,23 +22,23 @@
|
|||
#include "crypto/hash.h"
|
||||
#include "hashpriv.h"
|
||||
|
||||
static size_t qcrypto_hash_alg_size[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = QCRYPTO_HASH_DIGEST_LEN_MD5,
|
||||
[QCRYPTO_HASH_ALG_SHA1] = QCRYPTO_HASH_DIGEST_LEN_SHA1,
|
||||
[QCRYPTO_HASH_ALG_SHA224] = QCRYPTO_HASH_DIGEST_LEN_SHA224,
|
||||
[QCRYPTO_HASH_ALG_SHA256] = QCRYPTO_HASH_DIGEST_LEN_SHA256,
|
||||
[QCRYPTO_HASH_ALG_SHA384] = QCRYPTO_HASH_DIGEST_LEN_SHA384,
|
||||
[QCRYPTO_HASH_ALG_SHA512] = QCRYPTO_HASH_DIGEST_LEN_SHA512,
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = QCRYPTO_HASH_DIGEST_LEN_RIPEMD160,
|
||||
static size_t qcrypto_hash_alg_size[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = QCRYPTO_HASH_DIGEST_LEN_MD5,
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = QCRYPTO_HASH_DIGEST_LEN_SHA1,
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = QCRYPTO_HASH_DIGEST_LEN_SHA224,
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = QCRYPTO_HASH_DIGEST_LEN_SHA256,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = QCRYPTO_HASH_DIGEST_LEN_SHA384,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = QCRYPTO_HASH_DIGEST_LEN_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = QCRYPTO_HASH_DIGEST_LEN_RIPEMD160,
|
||||
};
|
||||
|
||||
size_t qcrypto_hash_digest_len(QCryptoHashAlgorithm alg)
|
||||
size_t qcrypto_hash_digest_len(QCryptoHashAlgo alg)
|
||||
{
|
||||
assert(alg < G_N_ELEMENTS(qcrypto_hash_alg_size));
|
||||
return qcrypto_hash_alg_size[alg];
|
||||
}
|
||||
|
||||
int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_bytesv(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
uint8_t **result,
|
||||
|
@ -65,7 +65,7 @@ int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg,
|
|||
}
|
||||
|
||||
|
||||
int qcrypto_hash_bytes(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_bytes(QCryptoHashAlgo alg,
|
||||
const char *buf,
|
||||
size_t len,
|
||||
uint8_t **result,
|
||||
|
@ -79,7 +79,7 @@ int qcrypto_hash_bytes(QCryptoHashAlgorithm alg,
|
|||
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
|
||||
int qcrypto_hash_digestv(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_digestv(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
char **digest,
|
||||
|
@ -103,7 +103,7 @@ int qcrypto_hash_digestv(QCryptoHashAlgorithm alg,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int qcrypto_hash_digest(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_digest(QCryptoHashAlgo alg,
|
||||
const char *buf,
|
||||
size_t len,
|
||||
char **digest,
|
||||
|
@ -114,7 +114,7 @@ int qcrypto_hash_digest(QCryptoHashAlgorithm alg,
|
|||
return qcrypto_hash_digestv(alg, &iov, 1, digest, errp);
|
||||
}
|
||||
|
||||
int qcrypto_hash_base64v(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_base64v(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
char **base64,
|
||||
|
@ -132,7 +132,7 @@ int qcrypto_hash_base64v(QCryptoHashAlgorithm alg,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int qcrypto_hash_base64(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_base64(QCryptoHashAlgo alg,
|
||||
const char *buf,
|
||||
size_t len,
|
||||
char **base64,
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
typedef struct QCryptoHashDriver QCryptoHashDriver;
|
||||
|
||||
struct QCryptoHashDriver {
|
||||
int (*hash_bytesv)(QCryptoHashAlgorithm alg,
|
||||
int (*hash_bytesv)(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
uint8_t **result,
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
#include "hmacpriv.h"
|
||||
#include <gcrypt.h>
|
||||
|
||||
static int qcrypto_hmac_alg_map[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = GCRY_MAC_HMAC_MD5,
|
||||
[QCRYPTO_HASH_ALG_SHA1] = GCRY_MAC_HMAC_SHA1,
|
||||
[QCRYPTO_HASH_ALG_SHA224] = GCRY_MAC_HMAC_SHA224,
|
||||
[QCRYPTO_HASH_ALG_SHA256] = GCRY_MAC_HMAC_SHA256,
|
||||
[QCRYPTO_HASH_ALG_SHA384] = GCRY_MAC_HMAC_SHA384,
|
||||
[QCRYPTO_HASH_ALG_SHA512] = GCRY_MAC_HMAC_SHA512,
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = GCRY_MAC_HMAC_RMD160,
|
||||
static int qcrypto_hmac_alg_map[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = GCRY_MAC_HMAC_MD5,
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = GCRY_MAC_HMAC_SHA1,
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = GCRY_MAC_HMAC_SHA224,
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = GCRY_MAC_HMAC_SHA256,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = GCRY_MAC_HMAC_SHA384,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = GCRY_MAC_HMAC_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = GCRY_MAC_HMAC_RMD160,
|
||||
};
|
||||
|
||||
typedef struct QCryptoHmacGcrypt QCryptoHmacGcrypt;
|
||||
|
@ -33,7 +33,7 @@ struct QCryptoHmacGcrypt {
|
|||
gcry_mac_hd_t handle;
|
||||
};
|
||||
|
||||
bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg)
|
||||
bool qcrypto_hmac_supports(QCryptoHashAlgo alg)
|
||||
{
|
||||
if (alg < G_N_ELEMENTS(qcrypto_hmac_alg_map) &&
|
||||
qcrypto_hmac_alg_map[alg] != GCRY_MAC_NONE) {
|
||||
|
@ -43,7 +43,7 @@ bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg)
|
|||
return false;
|
||||
}
|
||||
|
||||
void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
void *qcrypto_hmac_ctx_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
|||
|
||||
if (!qcrypto_hmac_supports(alg)) {
|
||||
error_setg(errp, "Unsupported hmac algorithm %s",
|
||||
QCryptoHashAlgorithm_str(alg));
|
||||
QCryptoHashAlgo_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
#include "crypto/hmac.h"
|
||||
#include "hmacpriv.h"
|
||||
|
||||
static int qcrypto_hmac_alg_map[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = G_CHECKSUM_MD5,
|
||||
[QCRYPTO_HASH_ALG_SHA1] = G_CHECKSUM_SHA1,
|
||||
[QCRYPTO_HASH_ALG_SHA256] = G_CHECKSUM_SHA256,
|
||||
[QCRYPTO_HASH_ALG_SHA512] = G_CHECKSUM_SHA512,
|
||||
[QCRYPTO_HASH_ALG_SHA224] = -1,
|
||||
[QCRYPTO_HASH_ALG_SHA384] = -1,
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = -1,
|
||||
static int qcrypto_hmac_alg_map[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = G_CHECKSUM_MD5,
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = G_CHECKSUM_SHA1,
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = G_CHECKSUM_SHA256,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = G_CHECKSUM_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = -1,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = -1,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = -1,
|
||||
};
|
||||
|
||||
typedef struct QCryptoHmacGlib QCryptoHmacGlib;
|
||||
|
@ -32,7 +32,7 @@ struct QCryptoHmacGlib {
|
|||
GHmac *ghmac;
|
||||
};
|
||||
|
||||
bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg)
|
||||
bool qcrypto_hmac_supports(QCryptoHashAlgo alg)
|
||||
{
|
||||
if (alg < G_N_ELEMENTS(qcrypto_hmac_alg_map) &&
|
||||
qcrypto_hmac_alg_map[alg] != -1) {
|
||||
|
@ -42,7 +42,7 @@ bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg)
|
|||
return false;
|
||||
}
|
||||
|
||||
void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
void *qcrypto_hmac_ctx_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
|||
|
||||
if (!qcrypto_hmac_supports(alg)) {
|
||||
error_setg(errp, "Unsupported hmac algorithm %s",
|
||||
QCryptoHashAlgorithm_str(alg));
|
||||
QCryptoHashAlgo_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
#include "crypto/hmac.h"
|
||||
#include "hmacpriv.h"
|
||||
|
||||
static int qcrypto_hmac_alg_map[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = GNUTLS_MAC_MD5,
|
||||
[QCRYPTO_HASH_ALG_SHA1] = GNUTLS_MAC_SHA1,
|
||||
[QCRYPTO_HASH_ALG_SHA224] = GNUTLS_MAC_SHA224,
|
||||
[QCRYPTO_HASH_ALG_SHA256] = GNUTLS_MAC_SHA256,
|
||||
[QCRYPTO_HASH_ALG_SHA384] = GNUTLS_MAC_SHA384,
|
||||
[QCRYPTO_HASH_ALG_SHA512] = GNUTLS_MAC_SHA512,
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = GNUTLS_MAC_RMD160,
|
||||
static int qcrypto_hmac_alg_map[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = GNUTLS_MAC_MD5,
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = GNUTLS_MAC_SHA1,
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = GNUTLS_MAC_SHA224,
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = GNUTLS_MAC_SHA256,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = GNUTLS_MAC_SHA384,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = GNUTLS_MAC_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = GNUTLS_MAC_RMD160,
|
||||
};
|
||||
|
||||
typedef struct QCryptoHmacGnutls QCryptoHmacGnutls;
|
||||
|
@ -35,7 +35,7 @@ struct QCryptoHmacGnutls {
|
|||
gnutls_hmac_hd_t handle;
|
||||
};
|
||||
|
||||
bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg)
|
||||
bool qcrypto_hmac_supports(QCryptoHashAlgo alg)
|
||||
{
|
||||
size_t i;
|
||||
const gnutls_digest_algorithm_t *algs;
|
||||
|
@ -52,7 +52,7 @@ bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg)
|
|||
return false;
|
||||
}
|
||||
|
||||
void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
void *qcrypto_hmac_ctx_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
|||
|
||||
if (!qcrypto_hmac_supports(alg)) {
|
||||
error_setg(errp, "Unsupported hmac algorithm %s",
|
||||
QCryptoHashAlgorithm_str(alg));
|
||||
QCryptoHashAlgo_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,44 +46,44 @@ struct qcrypto_nettle_hmac_alg {
|
|||
qcrypto_nettle_hmac_update update;
|
||||
qcrypto_nettle_hmac_digest digest;
|
||||
size_t len;
|
||||
} qcrypto_hmac_alg_map[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = {
|
||||
} qcrypto_hmac_alg_map[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = {
|
||||
.setkey = (qcrypto_nettle_hmac_setkey)hmac_md5_set_key,
|
||||
.update = (qcrypto_nettle_hmac_update)hmac_md5_update,
|
||||
.digest = (qcrypto_nettle_hmac_digest)hmac_md5_digest,
|
||||
.len = MD5_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_SHA1] = {
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = {
|
||||
.setkey = (qcrypto_nettle_hmac_setkey)hmac_sha1_set_key,
|
||||
.update = (qcrypto_nettle_hmac_update)hmac_sha1_update,
|
||||
.digest = (qcrypto_nettle_hmac_digest)hmac_sha1_digest,
|
||||
.len = SHA1_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_SHA224] = {
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = {
|
||||
.setkey = (qcrypto_nettle_hmac_setkey)hmac_sha224_set_key,
|
||||
.update = (qcrypto_nettle_hmac_update)hmac_sha224_update,
|
||||
.digest = (qcrypto_nettle_hmac_digest)hmac_sha224_digest,
|
||||
.len = SHA224_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_SHA256] = {
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = {
|
||||
.setkey = (qcrypto_nettle_hmac_setkey)hmac_sha256_set_key,
|
||||
.update = (qcrypto_nettle_hmac_update)hmac_sha256_update,
|
||||
.digest = (qcrypto_nettle_hmac_digest)hmac_sha256_digest,
|
||||
.len = SHA256_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_SHA384] = {
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = {
|
||||
.setkey = (qcrypto_nettle_hmac_setkey)hmac_sha384_set_key,
|
||||
.update = (qcrypto_nettle_hmac_update)hmac_sha384_update,
|
||||
.digest = (qcrypto_nettle_hmac_digest)hmac_sha384_digest,
|
||||
.len = SHA384_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_SHA512] = {
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = {
|
||||
.setkey = (qcrypto_nettle_hmac_setkey)hmac_sha512_set_key,
|
||||
.update = (qcrypto_nettle_hmac_update)hmac_sha512_update,
|
||||
.digest = (qcrypto_nettle_hmac_digest)hmac_sha512_digest,
|
||||
.len = SHA512_DIGEST_SIZE,
|
||||
},
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = {
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = {
|
||||
.setkey = (qcrypto_nettle_hmac_setkey)hmac_ripemd160_set_key,
|
||||
.update = (qcrypto_nettle_hmac_update)hmac_ripemd160_update,
|
||||
.digest = (qcrypto_nettle_hmac_digest)hmac_ripemd160_digest,
|
||||
|
@ -91,7 +91,7 @@ struct qcrypto_nettle_hmac_alg {
|
|||
},
|
||||
};
|
||||
|
||||
bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg)
|
||||
bool qcrypto_hmac_supports(QCryptoHashAlgo alg)
|
||||
{
|
||||
if (alg < G_N_ELEMENTS(qcrypto_hmac_alg_map) &&
|
||||
qcrypto_hmac_alg_map[alg].setkey != NULL) {
|
||||
|
@ -101,7 +101,7 @@ bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg)
|
|||
return false;
|
||||
}
|
||||
|
||||
void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
void *qcrypto_hmac_ctx_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
|||
|
||||
if (!qcrypto_hmac_supports(alg)) {
|
||||
error_setg(errp, "Unsupported hmac algorithm %s",
|
||||
QCryptoHashAlgorithm_str(alg));
|
||||
QCryptoHashAlgo_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ int qcrypto_hmac_digest(QCryptoHmac *hmac,
|
|||
return qcrypto_hmac_digestv(hmac, &iov, 1, digest, errp);
|
||||
}
|
||||
|
||||
QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgorithm alg,
|
||||
QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ struct QCryptoHmacDriver {
|
|||
void (*hmac_free)(QCryptoHmac *hmac);
|
||||
};
|
||||
|
||||
void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
void *qcrypto_hmac_ctx_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp);
|
||||
extern QCryptoHmacDriver qcrypto_hmac_lib_driver;
|
||||
|
@ -37,7 +37,7 @@ extern QCryptoHmacDriver qcrypto_hmac_lib_driver;
|
|||
|
||||
#include "afalgpriv.h"
|
||||
|
||||
QCryptoAFAlg *qcrypto_afalg_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
QCryptoAFAlgo *qcrypto_afalg_hmac_ctx_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp);
|
||||
extern QCryptoHmacDriver qcrypto_hmac_afalg_driver;
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
#include "ivgen-essiv.h"
|
||||
|
||||
|
||||
QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgorithm alg,
|
||||
QCryptoCipherAlgorithm cipheralg,
|
||||
QCryptoHashAlgorithm hash,
|
||||
QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgo alg,
|
||||
QCryptoCipherAlgo cipheralg,
|
||||
QCryptoHashAlgo hash,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -40,13 +40,13 @@ QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgorithm alg,
|
|||
ivgen->hash = hash;
|
||||
|
||||
switch (alg) {
|
||||
case QCRYPTO_IVGEN_ALG_PLAIN:
|
||||
case QCRYPTO_IV_GEN_ALGO_PLAIN:
|
||||
ivgen->driver = &qcrypto_ivgen_plain;
|
||||
break;
|
||||
case QCRYPTO_IVGEN_ALG_PLAIN64:
|
||||
case QCRYPTO_IV_GEN_ALGO_PLAIN64:
|
||||
ivgen->driver = &qcrypto_ivgen_plain64;
|
||||
break;
|
||||
case QCRYPTO_IVGEN_ALG_ESSIV:
|
||||
case QCRYPTO_IV_GEN_ALGO_ESSIV:
|
||||
ivgen->driver = &qcrypto_ivgen_essiv;
|
||||
break;
|
||||
default:
|
||||
|
@ -73,19 +73,19 @@ int qcrypto_ivgen_calculate(QCryptoIVGen *ivgen,
|
|||
}
|
||||
|
||||
|
||||
QCryptoIVGenAlgorithm qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen)
|
||||
QCryptoIVGenAlgo qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen)
|
||||
{
|
||||
return ivgen->algorithm;
|
||||
}
|
||||
|
||||
|
||||
QCryptoCipherAlgorithm qcrypto_ivgen_get_cipher(QCryptoIVGen *ivgen)
|
||||
QCryptoCipherAlgo qcrypto_ivgen_get_cipher(QCryptoIVGen *ivgen)
|
||||
{
|
||||
return ivgen->cipher;
|
||||
}
|
||||
|
||||
|
||||
QCryptoHashAlgorithm qcrypto_ivgen_get_hash(QCryptoIVGen *ivgen)
|
||||
QCryptoHashAlgo qcrypto_ivgen_get_hash(QCryptoIVGen *ivgen)
|
||||
{
|
||||
return ivgen->hash;
|
||||
}
|
||||
|
|
|
@ -40,9 +40,9 @@ struct QCryptoIVGen {
|
|||
QCryptoIVGenDriver *driver;
|
||||
void *private;
|
||||
|
||||
QCryptoIVGenAlgorithm algorithm;
|
||||
QCryptoCipherAlgorithm cipher;
|
||||
QCryptoHashAlgorithm hash;
|
||||
QCryptoIVGenAlgo algorithm;
|
||||
QCryptoCipherAlgo cipher;
|
||||
QCryptoHashAlgo hash;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -23,37 +23,37 @@
|
|||
#include "qapi/error.h"
|
||||
#include "crypto/pbkdf.h"
|
||||
|
||||
bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash)
|
||||
bool qcrypto_pbkdf2_supports(QCryptoHashAlgo hash)
|
||||
{
|
||||
switch (hash) {
|
||||
case QCRYPTO_HASH_ALG_MD5:
|
||||
case QCRYPTO_HASH_ALG_SHA1:
|
||||
case QCRYPTO_HASH_ALG_SHA224:
|
||||
case QCRYPTO_HASH_ALG_SHA256:
|
||||
case QCRYPTO_HASH_ALG_SHA384:
|
||||
case QCRYPTO_HASH_ALG_SHA512:
|
||||
case QCRYPTO_HASH_ALG_RIPEMD160:
|
||||
case QCRYPTO_HASH_ALGO_MD5:
|
||||
case QCRYPTO_HASH_ALGO_SHA1:
|
||||
case QCRYPTO_HASH_ALGO_SHA224:
|
||||
case QCRYPTO_HASH_ALGO_SHA256:
|
||||
case QCRYPTO_HASH_ALGO_SHA384:
|
||||
case QCRYPTO_HASH_ALGO_SHA512:
|
||||
case QCRYPTO_HASH_ALGO_RIPEMD160:
|
||||
return qcrypto_hash_supports(hash);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
||||
int qcrypto_pbkdf2(QCryptoHashAlgo hash,
|
||||
const uint8_t *key, size_t nkey,
|
||||
const uint8_t *salt, size_t nsalt,
|
||||
uint64_t iterations,
|
||||
uint8_t *out, size_t nout,
|
||||
Error **errp)
|
||||
{
|
||||
static const int hash_map[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = GCRY_MD_MD5,
|
||||
[QCRYPTO_HASH_ALG_SHA1] = GCRY_MD_SHA1,
|
||||
[QCRYPTO_HASH_ALG_SHA224] = GCRY_MD_SHA224,
|
||||
[QCRYPTO_HASH_ALG_SHA256] = GCRY_MD_SHA256,
|
||||
[QCRYPTO_HASH_ALG_SHA384] = GCRY_MD_SHA384,
|
||||
[QCRYPTO_HASH_ALG_SHA512] = GCRY_MD_SHA512,
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = GCRY_MD_RMD160,
|
||||
static const int hash_map[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = GCRY_MD_MD5,
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = GCRY_MD_SHA1,
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = GCRY_MD_SHA224,
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = GCRY_MD_SHA256,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = GCRY_MD_SHA384,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = GCRY_MD_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = GCRY_MD_RMD160,
|
||||
};
|
||||
int ret;
|
||||
|
||||
|
@ -68,7 +68,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
|||
hash_map[hash] == GCRY_MD_NONE) {
|
||||
error_setg_errno(errp, ENOSYS,
|
||||
"PBKDF does not support hash algorithm %s",
|
||||
QCryptoHashAlgorithm_str(hash));
|
||||
QCryptoHashAlgo_str(hash));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,37 +23,37 @@
|
|||
#include "qapi/error.h"
|
||||
#include "crypto/pbkdf.h"
|
||||
|
||||
bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash)
|
||||
bool qcrypto_pbkdf2_supports(QCryptoHashAlgo hash)
|
||||
{
|
||||
switch (hash) {
|
||||
case QCRYPTO_HASH_ALG_MD5:
|
||||
case QCRYPTO_HASH_ALG_SHA1:
|
||||
case QCRYPTO_HASH_ALG_SHA224:
|
||||
case QCRYPTO_HASH_ALG_SHA256:
|
||||
case QCRYPTO_HASH_ALG_SHA384:
|
||||
case QCRYPTO_HASH_ALG_SHA512:
|
||||
case QCRYPTO_HASH_ALG_RIPEMD160:
|
||||
case QCRYPTO_HASH_ALGO_MD5:
|
||||
case QCRYPTO_HASH_ALGO_SHA1:
|
||||
case QCRYPTO_HASH_ALGO_SHA224:
|
||||
case QCRYPTO_HASH_ALGO_SHA256:
|
||||
case QCRYPTO_HASH_ALGO_SHA384:
|
||||
case QCRYPTO_HASH_ALGO_SHA512:
|
||||
case QCRYPTO_HASH_ALGO_RIPEMD160:
|
||||
return qcrypto_hash_supports(hash);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
||||
int qcrypto_pbkdf2(QCryptoHashAlgo hash,
|
||||
const uint8_t *key, size_t nkey,
|
||||
const uint8_t *salt, size_t nsalt,
|
||||
uint64_t iterations,
|
||||
uint8_t *out, size_t nout,
|
||||
Error **errp)
|
||||
{
|
||||
static const int hash_map[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = GNUTLS_DIG_MD5,
|
||||
[QCRYPTO_HASH_ALG_SHA1] = GNUTLS_DIG_SHA1,
|
||||
[QCRYPTO_HASH_ALG_SHA224] = GNUTLS_DIG_SHA224,
|
||||
[QCRYPTO_HASH_ALG_SHA256] = GNUTLS_DIG_SHA256,
|
||||
[QCRYPTO_HASH_ALG_SHA384] = GNUTLS_DIG_SHA384,
|
||||
[QCRYPTO_HASH_ALG_SHA512] = GNUTLS_DIG_SHA512,
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = GNUTLS_DIG_RMD160,
|
||||
static const int hash_map[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = GNUTLS_DIG_MD5,
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = GNUTLS_DIG_SHA1,
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = GNUTLS_DIG_SHA224,
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = GNUTLS_DIG_SHA256,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = GNUTLS_DIG_SHA384,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = GNUTLS_DIG_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = GNUTLS_DIG_RMD160,
|
||||
};
|
||||
int ret;
|
||||
const gnutls_datum_t gkey = { (unsigned char *)key, nkey };
|
||||
|
@ -70,7 +70,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
|||
hash_map[hash] == GNUTLS_DIG_UNKNOWN) {
|
||||
error_setg_errno(errp, ENOSYS,
|
||||
"PBKDF does not support hash algorithm %s",
|
||||
QCryptoHashAlgorithm_str(hash));
|
||||
QCryptoHashAlgo_str(hash));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,22 +25,22 @@
|
|||
#include "crypto/pbkdf.h"
|
||||
|
||||
|
||||
bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash)
|
||||
bool qcrypto_pbkdf2_supports(QCryptoHashAlgo hash)
|
||||
{
|
||||
switch (hash) {
|
||||
case QCRYPTO_HASH_ALG_SHA1:
|
||||
case QCRYPTO_HASH_ALG_SHA224:
|
||||
case QCRYPTO_HASH_ALG_SHA256:
|
||||
case QCRYPTO_HASH_ALG_SHA384:
|
||||
case QCRYPTO_HASH_ALG_SHA512:
|
||||
case QCRYPTO_HASH_ALG_RIPEMD160:
|
||||
case QCRYPTO_HASH_ALGO_SHA1:
|
||||
case QCRYPTO_HASH_ALGO_SHA224:
|
||||
case QCRYPTO_HASH_ALGO_SHA256:
|
||||
case QCRYPTO_HASH_ALGO_SHA384:
|
||||
case QCRYPTO_HASH_ALGO_SHA512:
|
||||
case QCRYPTO_HASH_ALGO_RIPEMD160:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
||||
int qcrypto_pbkdf2(QCryptoHashAlgo hash,
|
||||
const uint8_t *key, size_t nkey,
|
||||
const uint8_t *salt, size_t nsalt,
|
||||
uint64_t iterations,
|
||||
|
@ -65,43 +65,43 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
|||
}
|
||||
|
||||
switch (hash) {
|
||||
case QCRYPTO_HASH_ALG_MD5:
|
||||
case QCRYPTO_HASH_ALGO_MD5:
|
||||
hmac_md5_set_key(&ctx.md5, nkey, key);
|
||||
PBKDF2(&ctx.md5, hmac_md5_update, hmac_md5_digest,
|
||||
MD5_DIGEST_SIZE, iterations, nsalt, salt, nout, out);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA1:
|
||||
case QCRYPTO_HASH_ALGO_SHA1:
|
||||
hmac_sha1_set_key(&ctx.sha1, nkey, key);
|
||||
PBKDF2(&ctx.sha1, hmac_sha1_update, hmac_sha1_digest,
|
||||
SHA1_DIGEST_SIZE, iterations, nsalt, salt, nout, out);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA224:
|
||||
case QCRYPTO_HASH_ALGO_SHA224:
|
||||
hmac_sha224_set_key(&ctx.sha224, nkey, key);
|
||||
PBKDF2(&ctx.sha224, hmac_sha224_update, hmac_sha224_digest,
|
||||
SHA224_DIGEST_SIZE, iterations, nsalt, salt, nout, out);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA256:
|
||||
case QCRYPTO_HASH_ALGO_SHA256:
|
||||
hmac_sha256_set_key(&ctx.sha256, nkey, key);
|
||||
PBKDF2(&ctx.sha256, hmac_sha256_update, hmac_sha256_digest,
|
||||
SHA256_DIGEST_SIZE, iterations, nsalt, salt, nout, out);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA384:
|
||||
case QCRYPTO_HASH_ALGO_SHA384:
|
||||
hmac_sha384_set_key(&ctx.sha384, nkey, key);
|
||||
PBKDF2(&ctx.sha384, hmac_sha384_update, hmac_sha384_digest,
|
||||
SHA384_DIGEST_SIZE, iterations, nsalt, salt, nout, out);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_SHA512:
|
||||
case QCRYPTO_HASH_ALGO_SHA512:
|
||||
hmac_sha512_set_key(&ctx.sha512, nkey, key);
|
||||
PBKDF2(&ctx.sha512, hmac_sha512_update, hmac_sha512_digest,
|
||||
SHA512_DIGEST_SIZE, iterations, nsalt, salt, nout, out);
|
||||
break;
|
||||
|
||||
case QCRYPTO_HASH_ALG_RIPEMD160:
|
||||
case QCRYPTO_HASH_ALGO_RIPEMD160:
|
||||
hmac_ripemd160_set_key(&ctx.ripemd160, nkey, key);
|
||||
PBKDF2(&ctx.ripemd160, hmac_ripemd160_update, hmac_ripemd160_digest,
|
||||
RIPEMD160_DIGEST_SIZE, iterations, nsalt, salt, nout, out);
|
||||
|
@ -110,7 +110,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
|||
default:
|
||||
error_setg_errno(errp, ENOSYS,
|
||||
"PBKDF does not support hash algorithm %s",
|
||||
QCryptoHashAlgorithm_str(hash));
|
||||
QCryptoHashAlgo_str(hash));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
#include "qapi/error.h"
|
||||
#include "crypto/pbkdf.h"
|
||||
|
||||
bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash G_GNUC_UNUSED)
|
||||
bool qcrypto_pbkdf2_supports(QCryptoHashAlgo hash G_GNUC_UNUSED)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int qcrypto_pbkdf2(QCryptoHashAlgorithm hash G_GNUC_UNUSED,
|
||||
int qcrypto_pbkdf2(QCryptoHashAlgo hash G_GNUC_UNUSED,
|
||||
const uint8_t *key G_GNUC_UNUSED,
|
||||
size_t nkey G_GNUC_UNUSED,
|
||||
const uint8_t *salt G_GNUC_UNUSED,
|
||||
|
|
|
@ -87,7 +87,7 @@ static int qcrypto_pbkdf2_get_thread_cpu(unsigned long long *val_ms,
|
|||
}
|
||||
|
||||
typedef struct CountItersData {
|
||||
QCryptoHashAlgorithm hash;
|
||||
QCryptoHashAlgo hash;
|
||||
const uint8_t *key;
|
||||
size_t nkey;
|
||||
const uint8_t *salt;
|
||||
|
@ -100,7 +100,7 @@ typedef struct CountItersData {
|
|||
static void *threaded_qcrypto_pbkdf2_count_iters(void *data)
|
||||
{
|
||||
CountItersData *iters_data = (CountItersData *) data;
|
||||
QCryptoHashAlgorithm hash = iters_data->hash;
|
||||
QCryptoHashAlgo hash = iters_data->hash;
|
||||
const uint8_t *key = iters_data->key;
|
||||
size_t nkey = iters_data->nkey;
|
||||
const uint8_t *salt = iters_data->salt;
|
||||
|
@ -153,7 +153,7 @@ static void *threaded_qcrypto_pbkdf2_count_iters(void *data)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
uint64_t qcrypto_pbkdf2_count_iters(QCryptoHashAlgorithm hash,
|
||||
uint64_t qcrypto_pbkdf2_count_iters(QCryptoHashAlgo hash,
|
||||
const uint8_t *key, size_t nkey,
|
||||
const uint8_t *salt, size_t nsalt,
|
||||
size_t nout,
|
||||
|
|
|
@ -183,10 +183,10 @@ QCryptoAkCipherRSAKey *qcrypto_akcipher_rsakey_parse(
|
|||
size_t keylen, Error **errp)
|
||||
{
|
||||
switch (type) {
|
||||
case QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE:
|
||||
case QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE:
|
||||
return qcrypto_builtin_rsa_private_key_parse(key, keylen, errp);
|
||||
|
||||
case QCRYPTO_AKCIPHER_KEY_TYPE_PUBLIC:
|
||||
case QCRYPTO_AK_CIPHER_KEY_TYPE_PUBLIC:
|
||||
return qcrypto_builtin_rsa_public_key_parse(key, keylen, errp);
|
||||
|
||||
default:
|
||||
|
|
|
@ -145,10 +145,10 @@ QCryptoAkCipherRSAKey *qcrypto_akcipher_rsakey_parse(
|
|||
size_t keylen, Error **errp)
|
||||
{
|
||||
switch (type) {
|
||||
case QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE:
|
||||
case QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE:
|
||||
return qcrypto_nettle_rsa_private_key_parse(key, keylen, errp);
|
||||
|
||||
case QCRYPTO_AKCIPHER_KEY_TYPE_PUBLIC:
|
||||
case QCRYPTO_AK_CIPHER_KEY_TYPE_PUBLIC:
|
||||
return qcrypto_nettle_rsa_public_key_parse(key, keylen, errp);
|
||||
|
||||
default:
|
||||
|
|
|
@ -71,7 +71,7 @@ static void qcrypto_secret_decrypt(QCryptoSecretCommon *secret,
|
|||
return;
|
||||
}
|
||||
|
||||
aes = qcrypto_cipher_new(QCRYPTO_CIPHER_ALG_AES_256,
|
||||
aes = qcrypto_cipher_new(QCRYPTO_CIPHER_ALGO_AES_256,
|
||||
QCRYPTO_CIPHER_MODE_CBC,
|
||||
key, keylen,
|
||||
errp);
|
||||
|
|
|
@ -15,18 +15,18 @@
|
|||
#include <gnutls/crypto.h>
|
||||
#include <gnutls/x509.h>
|
||||
|
||||
static const int qcrypto_to_gnutls_hash_alg_map[QCRYPTO_HASH_ALG__MAX] = {
|
||||
[QCRYPTO_HASH_ALG_MD5] = GNUTLS_DIG_MD5,
|
||||
[QCRYPTO_HASH_ALG_SHA1] = GNUTLS_DIG_SHA1,
|
||||
[QCRYPTO_HASH_ALG_SHA224] = GNUTLS_DIG_SHA224,
|
||||
[QCRYPTO_HASH_ALG_SHA256] = GNUTLS_DIG_SHA256,
|
||||
[QCRYPTO_HASH_ALG_SHA384] = GNUTLS_DIG_SHA384,
|
||||
[QCRYPTO_HASH_ALG_SHA512] = GNUTLS_DIG_SHA512,
|
||||
[QCRYPTO_HASH_ALG_RIPEMD160] = GNUTLS_DIG_RMD160,
|
||||
static const int qcrypto_to_gnutls_hash_alg_map[QCRYPTO_HASH_ALGO__MAX] = {
|
||||
[QCRYPTO_HASH_ALGO_MD5] = GNUTLS_DIG_MD5,
|
||||
[QCRYPTO_HASH_ALGO_SHA1] = GNUTLS_DIG_SHA1,
|
||||
[QCRYPTO_HASH_ALGO_SHA224] = GNUTLS_DIG_SHA224,
|
||||
[QCRYPTO_HASH_ALGO_SHA256] = GNUTLS_DIG_SHA256,
|
||||
[QCRYPTO_HASH_ALGO_SHA384] = GNUTLS_DIG_SHA384,
|
||||
[QCRYPTO_HASH_ALGO_SHA512] = GNUTLS_DIG_SHA512,
|
||||
[QCRYPTO_HASH_ALGO_RIPEMD160] = GNUTLS_DIG_RMD160,
|
||||
};
|
||||
|
||||
int qcrypto_get_x509_cert_fingerprint(uint8_t *cert, size_t size,
|
||||
QCryptoHashAlgorithm alg,
|
||||
QCryptoHashAlgo alg,
|
||||
uint8_t *result,
|
||||
size_t *resultlen,
|
||||
Error **errp)
|
||||
|
|
|
@ -271,4 +271,4 @@ void ebpf_rss_unload(struct EBPFRSSContext *ctx)
|
|||
ctx->map_indirections_table = -1;
|
||||
}
|
||||
|
||||
ebpf_binary_init(EBPF_PROGRAMID_RSS, rss_bpf__elf_bytes)
|
||||
ebpf_binary_init(EBPF_PROGRAM_ID_RSS, rss_bpf__elf_bytes)
|
||||
|
|
|
@ -249,7 +249,7 @@ void parse_numa_hmat_lb(NumaState *numa_state, NumaHmatLBOptions *node,
|
|||
lb_data.initiator = node->initiator;
|
||||
lb_data.target = node->target;
|
||||
|
||||
if (node->data_type <= HMATLB_DATA_TYPE_WRITE_LATENCY) {
|
||||
if (node->data_type <= HMAT_LB_DATA_TYPE_WRITE_LATENCY) {
|
||||
/* Input latency data */
|
||||
|
||||
if (!node->has_latency) {
|
||||
|
@ -313,7 +313,7 @@ void parse_numa_hmat_lb(NumaState *numa_state, NumaHmatLBOptions *node,
|
|||
numa_info[node->target].lb_info_provided |= BIT(0);
|
||||
}
|
||||
lb_data.data = node->latency;
|
||||
} else if (node->data_type >= HMATLB_DATA_TYPE_ACCESS_BANDWIDTH) {
|
||||
} else if (node->data_type >= HMAT_LB_DATA_TYPE_ACCESS_BANDWIDTH) {
|
||||
/* Input bandwidth data */
|
||||
if (!node->has_bandwidth) {
|
||||
error_setg(errp, "Missing 'bandwidth' option");
|
||||
|
|
|
@ -1188,12 +1188,12 @@ const PropertyInfo qdev_prop_uuid = {
|
|||
|
||||
/* --- s390 cpu entitlement policy --- */
|
||||
|
||||
QEMU_BUILD_BUG_ON(sizeof(CpuS390Entitlement) != sizeof(int));
|
||||
QEMU_BUILD_BUG_ON(sizeof(S390CpuEntitlement) != sizeof(int));
|
||||
|
||||
const PropertyInfo qdev_prop_cpus390entitlement = {
|
||||
.name = "CpuS390Entitlement",
|
||||
.name = "S390CpuEntitlement",
|
||||
.description = "low/medium (default)/high",
|
||||
.enum_table = &CpuS390Entitlement_lookup,
|
||||
.enum_table = &S390CpuEntitlement_lookup,
|
||||
.get = qdev_propinfo_get_enum,
|
||||
.set = qdev_propinfo_set_enum,
|
||||
.set_default_value = qdev_propinfo_set_default_value_enum,
|
||||
|
|
|
@ -68,15 +68,15 @@
|
|||
|
||||
static const struct {
|
||||
uint32_t mask;
|
||||
QCryptoHashAlgorithm algo;
|
||||
QCryptoHashAlgo algo;
|
||||
} hash_algo_map[] = {
|
||||
{ HASH_ALGO_MD5, QCRYPTO_HASH_ALG_MD5 },
|
||||
{ HASH_ALGO_SHA1, QCRYPTO_HASH_ALG_SHA1 },
|
||||
{ HASH_ALGO_SHA224, QCRYPTO_HASH_ALG_SHA224 },
|
||||
{ HASH_ALGO_SHA256, QCRYPTO_HASH_ALG_SHA256 },
|
||||
{ HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA512, QCRYPTO_HASH_ALG_SHA512 },
|
||||
{ HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA384, QCRYPTO_HASH_ALG_SHA384 },
|
||||
{ HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA256, QCRYPTO_HASH_ALG_SHA256 },
|
||||
{ HASH_ALGO_MD5, QCRYPTO_HASH_ALGO_MD5 },
|
||||
{ HASH_ALGO_SHA1, QCRYPTO_HASH_ALGO_SHA1 },
|
||||
{ HASH_ALGO_SHA224, QCRYPTO_HASH_ALGO_SHA224 },
|
||||
{ HASH_ALGO_SHA256, QCRYPTO_HASH_ALGO_SHA256 },
|
||||
{ HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA512, QCRYPTO_HASH_ALGO_SHA512 },
|
||||
{ HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA384, QCRYPTO_HASH_ALGO_SHA384 },
|
||||
{ HASH_ALGO_SHA512_SERIES | HASH_ALGO_SHA512_SHA256, QCRYPTO_HASH_ALGO_SHA256 },
|
||||
};
|
||||
|
||||
static int hash_algo_lookup(uint32_t reg)
|
||||
|
|
|
@ -234,7 +234,7 @@ static int build_cdat_table(CDATSubHeader ***cdat_table, void *priv)
|
|||
.type = CDAT_TYPE_SSLBIS,
|
||||
.length = sslbis_size,
|
||||
},
|
||||
.data_type = HMATLB_DATA_TYPE_ACCESS_LATENCY,
|
||||
.data_type = HMAT_LB_DATA_TYPE_ACCESS_LATENCY,
|
||||
.entry_base_unit = 10000,
|
||||
},
|
||||
};
|
||||
|
@ -254,7 +254,7 @@ static int build_cdat_table(CDATSubHeader ***cdat_table, void *priv)
|
|||
.type = CDAT_TYPE_SSLBIS,
|
||||
.length = sslbis_size,
|
||||
},
|
||||
.data_type = HMATLB_DATA_TYPE_ACCESS_BANDWIDTH,
|
||||
.data_type = HMAT_LB_DATA_TYPE_ACCESS_BANDWIDTH,
|
||||
.entry_base_unit = 1024,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -105,7 +105,7 @@ static void s390_topology_init(MachineState *ms)
|
|||
*/
|
||||
void s390_handle_ptf(S390CPU *cpu, uint8_t r1, uintptr_t ra)
|
||||
{
|
||||
CpuS390Polarization polarization;
|
||||
S390CpuPolarization polarization;
|
||||
CPUS390XState *env = &cpu->env;
|
||||
uint64_t reg = env->regs[r1];
|
||||
int fc = reg & S390_TOPO_FC_MASK;
|
||||
|
@ -357,7 +357,7 @@ static void s390_change_topology(uint16_t core_id,
|
|||
bool has_book_id, uint16_t book_id,
|
||||
bool has_drawer_id, uint16_t drawer_id,
|
||||
bool has_entitlement,
|
||||
CpuS390Entitlement entitlement,
|
||||
S390CpuEntitlement entitlement,
|
||||
bool has_dedicated, bool dedicated,
|
||||
Error **errp)
|
||||
{
|
||||
|
@ -446,7 +446,7 @@ void qmp_set_cpu_topology(uint16_t core,
|
|||
bool has_socket, uint16_t socket,
|
||||
bool has_book, uint16_t book,
|
||||
bool has_drawer, uint16_t drawer,
|
||||
bool has_entitlement, CpuS390Entitlement entitlement,
|
||||
bool has_entitlement, S390CpuEntitlement entitlement,
|
||||
bool has_dedicated, bool dedicated,
|
||||
Error **errp)
|
||||
{
|
||||
|
|
|
@ -81,7 +81,7 @@ static const char *mig_state_to_str(enum vfio_device_mig_state state)
|
|||
}
|
||||
}
|
||||
|
||||
static VfioMigrationState
|
||||
static QapiVfioMigrationState
|
||||
mig_state_to_qapi_state(enum vfio_device_mig_state state)
|
||||
{
|
||||
switch (state) {
|
||||
|
|
|
@ -1452,7 +1452,7 @@ static bool vfio_pci_relocate_msix(VFIOPCIDevice *vdev, Error **errp)
|
|||
int target_bar = -1;
|
||||
size_t msix_sz;
|
||||
|
||||
if (!vdev->msix || vdev->msix_relo == OFF_AUTOPCIBAR_OFF) {
|
||||
if (!vdev->msix || vdev->msix_relo == OFF_AUTO_PCIBAR_OFF) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1464,7 +1464,7 @@ static bool vfio_pci_relocate_msix(VFIOPCIDevice *vdev, Error **errp)
|
|||
/* PCI BARs must be a power of 2 */
|
||||
msix_sz = pow2ceil(msix_sz);
|
||||
|
||||
if (vdev->msix_relo == OFF_AUTOPCIBAR_AUTO) {
|
||||
if (vdev->msix_relo == OFF_AUTO_PCIBAR_AUTO) {
|
||||
/*
|
||||
* TODO: Lookup table for known devices.
|
||||
*
|
||||
|
@ -1479,7 +1479,7 @@ static bool vfio_pci_relocate_msix(VFIOPCIDevice *vdev, Error **errp)
|
|||
return false;
|
||||
}
|
||||
} else {
|
||||
target_bar = (int)(vdev->msix_relo - OFF_AUTOPCIBAR_BAR0);
|
||||
target_bar = (int)(vdev->msix_relo - OFF_AUTO_PCIBAR_BAR0);
|
||||
}
|
||||
|
||||
/* I/O port BARs cannot host MSI-X structures */
|
||||
|
@ -1624,7 +1624,7 @@ static bool vfio_msix_early_setup(VFIOPCIDevice *vdev, Error **errp)
|
|||
} else if (vfio_pci_is(vdev, PCI_VENDOR_ID_BAIDU,
|
||||
PCI_DEVICE_ID_KUNLUN_VF)) {
|
||||
msix->pba_offset = 0xb400;
|
||||
} else if (vdev->msix_relo == OFF_AUTOPCIBAR_OFF) {
|
||||
} else if (vdev->msix_relo == OFF_AUTO_PCIBAR_OFF) {
|
||||
error_setg(errp, "hardware reports invalid configuration, "
|
||||
"MSIX PBA outside of specified BAR");
|
||||
g_free(msix);
|
||||
|
@ -3403,7 +3403,7 @@ static Property vfio_pci_dev_properties[] = {
|
|||
nv_gpudirect_clique,
|
||||
qdev_prop_nv_gpudirect_clique, uint8_t),
|
||||
DEFINE_PROP_OFF_AUTO_PCIBAR("x-msix-relocation", VFIOPCIDevice, msix_relo,
|
||||
OFF_AUTOPCIBAR_OFF),
|
||||
OFF_AUTO_PCIBAR_OFF),
|
||||
#ifdef CONFIG_IOMMUFD
|
||||
DEFINE_PROP_LINK("iommufd", VFIOPCIDevice, vbasedev.iommufd,
|
||||
TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *),
|
||||
|
|
|
@ -461,7 +461,7 @@ static void virtio_crypto_init_request(VirtIOCrypto *vcrypto, VirtQueue *vq,
|
|||
req->in_iov = NULL;
|
||||
req->in_num = 0;
|
||||
req->in_len = 0;
|
||||
req->flags = QCRYPTODEV_BACKEND_ALG__MAX;
|
||||
req->flags = QCRYPTODEV_BACKEND_ALGO_TYPE__MAX;
|
||||
memset(&req->op_info, 0x00, sizeof(req->op_info));
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ static void virtio_crypto_free_request(VirtIOCryptoReq *req)
|
|||
return;
|
||||
}
|
||||
|
||||
if (req->flags == QCRYPTODEV_BACKEND_ALG_SYM) {
|
||||
if (req->flags == QCRYPTODEV_BACKEND_ALGO_TYPE_SYM) {
|
||||
size_t max_len;
|
||||
CryptoDevBackendSymOpInfo *op_info = req->op_info.u.sym_op_info;
|
||||
|
||||
|
@ -486,7 +486,7 @@ static void virtio_crypto_free_request(VirtIOCryptoReq *req)
|
|||
memset(op_info, 0, sizeof(*op_info) + max_len);
|
||||
g_free(op_info);
|
||||
}
|
||||
} else if (req->flags == QCRYPTODEV_BACKEND_ALG_ASYM) {
|
||||
} else if (req->flags == QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) {
|
||||
CryptoDevBackendAsymOpInfo *op_info = req->op_info.u.asym_op_info;
|
||||
if (op_info) {
|
||||
g_free(op_info->src);
|
||||
|
@ -571,10 +571,10 @@ static void virtio_crypto_req_complete(void *opaque, int ret)
|
|||
VirtIODevice *vdev = VIRTIO_DEVICE(vcrypto);
|
||||
uint8_t status = -ret;
|
||||
|
||||
if (req->flags == QCRYPTODEV_BACKEND_ALG_SYM) {
|
||||
if (req->flags == QCRYPTODEV_BACKEND_ALGO_TYPE_SYM) {
|
||||
virtio_crypto_sym_input_data_helper(vdev, req, status,
|
||||
req->op_info.u.sym_op_info);
|
||||
} else if (req->flags == QCRYPTODEV_BACKEND_ALG_ASYM) {
|
||||
} else if (req->flags == QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM) {
|
||||
virtio_crypto_akcipher_input_data_helper(vdev, req, status,
|
||||
req->op_info.u.asym_op_info);
|
||||
}
|
||||
|
@ -884,7 +884,7 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request)
|
|||
switch (opcode) {
|
||||
case VIRTIO_CRYPTO_CIPHER_ENCRYPT:
|
||||
case VIRTIO_CRYPTO_CIPHER_DECRYPT:
|
||||
op_info->algtype = request->flags = QCRYPTODEV_BACKEND_ALG_SYM;
|
||||
op_info->algtype = request->flags = QCRYPTODEV_BACKEND_ALGO_TYPE_SYM;
|
||||
ret = virtio_crypto_handle_sym_req(vcrypto,
|
||||
&req.u.sym_req, op_info,
|
||||
out_iov, out_num);
|
||||
|
@ -894,7 +894,7 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request)
|
|||
case VIRTIO_CRYPTO_AKCIPHER_DECRYPT:
|
||||
case VIRTIO_CRYPTO_AKCIPHER_SIGN:
|
||||
case VIRTIO_CRYPTO_AKCIPHER_VERIFY:
|
||||
op_info->algtype = request->flags = QCRYPTODEV_BACKEND_ALG_ASYM;
|
||||
op_info->algtype = request->flags = QCRYPTODEV_BACKEND_ALGO_TYPE_ASYM;
|
||||
ret = virtio_crypto_handle_asym_req(vcrypto,
|
||||
&req.u.akcipher_req, op_info,
|
||||
out_iov, out_num);
|
||||
|
@ -1008,19 +1008,19 @@ static uint32_t virtio_crypto_init_services(uint32_t qservices)
|
|||
{
|
||||
uint32_t vservices = 0;
|
||||
|
||||
if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_CIPHER)) {
|
||||
if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_TYPE_CIPHER)) {
|
||||
vservices |= (1 << VIRTIO_CRYPTO_SERVICE_CIPHER);
|
||||
}
|
||||
if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_HASH)) {
|
||||
if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_TYPE_HASH)) {
|
||||
vservices |= (1 << VIRTIO_CRYPTO_SERVICE_HASH);
|
||||
}
|
||||
if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_MAC)) {
|
||||
if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_TYPE_MAC)) {
|
||||
vservices |= (1 << VIRTIO_CRYPTO_SERVICE_MAC);
|
||||
}
|
||||
if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_AEAD)) {
|
||||
if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_TYPE_AEAD)) {
|
||||
vservices |= (1 << VIRTIO_CRYPTO_SERVICE_AEAD);
|
||||
}
|
||||
if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_AKCIPHER)) {
|
||||
if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_TYPE_AKCIPHER)) {
|
||||
vservices |= (1 << VIRTIO_CRYPTO_SERVICE_AKCIPHER);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
*
|
||||
* splitkey = g_new0(uint8_t, nkey * stripes);
|
||||
*
|
||||
* if (qcrypto_afsplit_encode(QCRYPTO_HASH_ALG_SHA256,
|
||||
* if (qcrypto_afsplit_encode(QCRYPTO_HASH_ALGO_SHA256,
|
||||
* nkey, stripes,
|
||||
* masterkey, splitkey, errp) < 0) {
|
||||
* g_free(splitkey);
|
||||
|
@ -71,7 +71,7 @@
|
|||
*
|
||||
* masterkey = g_new0(uint8_t, nkey);
|
||||
*
|
||||
* if (qcrypto_afsplit_decode(QCRYPTO_HASH_ALG_SHA256,
|
||||
* if (qcrypto_afsplit_decode(QCRYPTO_HASH_ALGO_SHA256,
|
||||
* nkey, stripes,
|
||||
* splitkey, masterkey, errp) < 0) {
|
||||
* g_free(splitkey);
|
||||
|
@ -102,7 +102,7 @@
|
|||
*
|
||||
* Returns: 0 on success, -1 on error;
|
||||
*/
|
||||
int qcrypto_afsplit_encode(QCryptoHashAlgorithm hash,
|
||||
int qcrypto_afsplit_encode(QCryptoHashAlgo hash,
|
||||
size_t blocklen,
|
||||
uint32_t stripes,
|
||||
const uint8_t *in,
|
||||
|
@ -124,7 +124,7 @@ int qcrypto_afsplit_encode(QCryptoHashAlgorithm hash,
|
|||
*
|
||||
* Returns: 0 on success, -1 on error;
|
||||
*/
|
||||
int qcrypto_afsplit_decode(QCryptoHashAlgorithm hash,
|
||||
int qcrypto_afsplit_decode(QCryptoHashAlgo hash,
|
||||
size_t blocklen,
|
||||
uint32_t stripes,
|
||||
const uint8_t *in,
|
||||
|
|
|
@ -287,7 +287,7 @@ QCryptoIVGen *qcrypto_block_get_ivgen(QCryptoBlock *block);
|
|||
*
|
||||
* Returns: the hash algorithm
|
||||
*/
|
||||
QCryptoHashAlgorithm qcrypto_block_get_kdf_hash(QCryptoBlock *block);
|
||||
QCryptoHashAlgo qcrypto_block_get_kdf_hash(QCryptoBlock *block);
|
||||
|
||||
/**
|
||||
* qcrypto_block_get_payload_offset:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#define QCRYPTO_HASH_DIGEST_LEN_SHA512 64
|
||||
#define QCRYPTO_HASH_DIGEST_LEN_RIPEMD160 20
|
||||
|
||||
/* See also "QCryptoHashAlgorithm" defined in qapi/crypto.json */
|
||||
/* See also "QCryptoHashAlgo" defined in qapi/crypto.json */
|
||||
|
||||
/**
|
||||
* qcrypto_hash_supports:
|
||||
|
@ -42,7 +42,7 @@
|
|||
*
|
||||
* Returns: true if the algorithm is supported, false otherwise
|
||||
*/
|
||||
gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg);
|
||||
gboolean qcrypto_hash_supports(QCryptoHashAlgo alg);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg);
|
|||
*
|
||||
* Returns: the digest length in bytes
|
||||
*/
|
||||
size_t qcrypto_hash_digest_len(QCryptoHashAlgorithm alg);
|
||||
size_t qcrypto_hash_digest_len(QCryptoHashAlgo alg);
|
||||
|
||||
/**
|
||||
* qcrypto_hash_bytesv:
|
||||
|
@ -73,7 +73,7 @@ size_t qcrypto_hash_digest_len(QCryptoHashAlgorithm alg);
|
|||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_bytesv(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
uint8_t **result,
|
||||
|
@ -98,7 +98,7 @@ int qcrypto_hash_bytesv(QCryptoHashAlgorithm alg,
|
|||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int qcrypto_hash_bytes(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_bytes(QCryptoHashAlgo alg,
|
||||
const char *buf,
|
||||
size_t len,
|
||||
uint8_t **result,
|
||||
|
@ -122,7 +122,7 @@ int qcrypto_hash_bytes(QCryptoHashAlgorithm alg,
|
|||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int qcrypto_hash_digestv(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_digestv(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
char **digest,
|
||||
|
@ -145,7 +145,7 @@ int qcrypto_hash_digestv(QCryptoHashAlgorithm alg,
|
|||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int qcrypto_hash_digest(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_digest(QCryptoHashAlgo alg,
|
||||
const char *buf,
|
||||
size_t len,
|
||||
char **digest,
|
||||
|
@ -168,7 +168,7 @@ int qcrypto_hash_digest(QCryptoHashAlgorithm alg,
|
|||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int qcrypto_hash_base64v(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_base64v(QCryptoHashAlgo alg,
|
||||
const struct iovec *iov,
|
||||
size_t niov,
|
||||
char **base64,
|
||||
|
@ -191,7 +191,7 @@ int qcrypto_hash_base64v(QCryptoHashAlgorithm alg,
|
|||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int qcrypto_hash_base64(QCryptoHashAlgorithm alg,
|
||||
int qcrypto_hash_base64(QCryptoHashAlgo alg,
|
||||
const char *buf,
|
||||
size_t len,
|
||||
char **base64,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
typedef struct QCryptoHmac QCryptoHmac;
|
||||
struct QCryptoHmac {
|
||||
QCryptoHashAlgorithm alg;
|
||||
QCryptoHashAlgo alg;
|
||||
void *opaque;
|
||||
void *driver;
|
||||
};
|
||||
|
@ -31,7 +31,7 @@ struct QCryptoHmac {
|
|||
* Returns:
|
||||
* true if the algorithm is supported, false otherwise
|
||||
*/
|
||||
bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg);
|
||||
bool qcrypto_hmac_supports(QCryptoHashAlgo alg);
|
||||
|
||||
/**
|
||||
* qcrypto_hmac_new:
|
||||
|
@ -52,7 +52,7 @@ bool qcrypto_hmac_supports(QCryptoHashAlgorithm alg);
|
|||
* Returns:
|
||||
* a new hmac object, or NULL on error
|
||||
*/
|
||||
QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgorithm alg,
|
||||
QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgo alg,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp);
|
||||
|
||||
|
|
|
@ -44,22 +44,22 @@
|
|||
*
|
||||
* g_assert((ndata % 512) == 0);
|
||||
*
|
||||
* QCryptoIVGen *ivgen = qcrypto_ivgen_new(QCRYPTO_IVGEN_ALG_ESSIV,
|
||||
* QCRYPTO_CIPHER_ALG_AES_128,
|
||||
* QCRYPTO_HASH_ALG_SHA256,
|
||||
* QCryptoIVGen *ivgen = qcrypto_ivgen_new(QCRYPTO_IV_GEN_ALGO_ESSIV,
|
||||
* QCRYPTO_CIPHER_ALGO_AES_128,
|
||||
* QCRYPTO_HASH_ALGO_SHA256,
|
||||
* key, nkey, errp);
|
||||
* if (!ivgen) {
|
||||
* return -1;
|
||||
* }
|
||||
*
|
||||
* QCryptoCipher *cipher = qcrypto_cipher_new(QCRYPTO_CIPHER_ALG_AES_128,
|
||||
* QCryptoCipher *cipher = qcrypto_cipher_new(QCRYPTO_CIPHER_ALGO_AES_128,
|
||||
* QCRYPTO_CIPHER_MODE_CBC,
|
||||
* key, nkey, errp);
|
||||
* if (!cipher) {
|
||||
* goto error;
|
||||
* }
|
||||
*
|
||||
* niv = qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALG_AES_128,
|
||||
* niv = qcrypto_cipher_get_iv_len(QCRYPTO_CIPHER_ALGO_AES_128,
|
||||
* QCRYPTO_CIPHER_MODE_CBC);
|
||||
* iv = g_new0(uint8_t, niv);
|
||||
*
|
||||
|
@ -97,7 +97,7 @@
|
|||
|
||||
typedef struct QCryptoIVGen QCryptoIVGen;
|
||||
|
||||
/* See also QCryptoIVGenAlgorithm enum in qapi/crypto.json */
|
||||
/* See also QCryptoIVGenAlgo enum in qapi/crypto.json */
|
||||
|
||||
|
||||
/**
|
||||
|
@ -113,19 +113,19 @@ typedef struct QCryptoIVGen QCryptoIVGen;
|
|||
* are required or not depends on the choice of @alg
|
||||
* requested.
|
||||
*
|
||||
* - QCRYPTO_IVGEN_ALG_PLAIN
|
||||
* - QCRYPTO_IV_GEN_ALGO_PLAIN
|
||||
*
|
||||
* The IVs are generated by the 32-bit truncated sector
|
||||
* number. This should never be used for block devices
|
||||
* that are larger than 2^32 sectors in size.
|
||||
* All the other parameters are unused.
|
||||
*
|
||||
* - QCRYPTO_IVGEN_ALG_PLAIN64
|
||||
* - QCRYPTO_IV_GEN_ALGO_PLAIN64
|
||||
*
|
||||
* The IVs are generated by the 64-bit sector number.
|
||||
* All the other parameters are unused.
|
||||
*
|
||||
* - QCRYPTO_IVGEN_ALG_ESSIV:
|
||||
* - QCRYPTO_IV_GEN_ALGO_ESSIV:
|
||||
*
|
||||
* The IVs are generated by encrypting the 64-bit sector
|
||||
* number with a hash of an encryption key. The @cipheralg,
|
||||
|
@ -133,9 +133,9 @@ typedef struct QCryptoIVGen QCryptoIVGen;
|
|||
*
|
||||
* Returns: a new IV generator, or NULL on error
|
||||
*/
|
||||
QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgorithm alg,
|
||||
QCryptoCipherAlgorithm cipheralg,
|
||||
QCryptoHashAlgorithm hash,
|
||||
QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgo alg,
|
||||
QCryptoCipherAlgo cipheralg,
|
||||
QCryptoHashAlgo hash,
|
||||
const uint8_t *key, size_t nkey,
|
||||
Error **errp);
|
||||
|
||||
|
@ -167,7 +167,7 @@ int qcrypto_ivgen_calculate(QCryptoIVGen *ivgen,
|
|||
*
|
||||
* Returns: the IV generator algorithm
|
||||
*/
|
||||
QCryptoIVGenAlgorithm qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen);
|
||||
QCryptoIVGenAlgo qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -179,7 +179,7 @@ QCryptoIVGenAlgorithm qcrypto_ivgen_get_algorithm(QCryptoIVGen *ivgen);
|
|||
*
|
||||
* Returns: the cipher algorithm
|
||||
*/
|
||||
QCryptoCipherAlgorithm qcrypto_ivgen_get_cipher(QCryptoIVGen *ivgen);
|
||||
QCryptoCipherAlgo qcrypto_ivgen_get_cipher(QCryptoIVGen *ivgen);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -191,7 +191,7 @@ QCryptoCipherAlgorithm qcrypto_ivgen_get_cipher(QCryptoIVGen *ivgen);
|
|||
*
|
||||
* Returns: the hash algorithm
|
||||
*/
|
||||
QCryptoHashAlgorithm qcrypto_ivgen_get_hash(QCryptoIVGen *ivgen);
|
||||
QCryptoHashAlgo qcrypto_ivgen_get_hash(QCryptoIVGen *ivgen);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* ....
|
||||
*
|
||||
* char *password = "a-typical-awful-user-password";
|
||||
* size_t nkey = qcrypto_cipher_get_key_len(QCRYPTO_CIPHER_ALG_AES_128);
|
||||
* size_t nkey = qcrypto_cipher_get_key_len(QCRYPTO_CIPHER_ALGO_AES_128);
|
||||
* uint8_t *salt = g_new0(uint8_t, nkey);
|
||||
* uint8_t *key = g_new0(uint8_t, nkey);
|
||||
* int iterations;
|
||||
|
@ -50,7 +50,7 @@
|
|||
* return -1;
|
||||
* }
|
||||
*
|
||||
* iterations = qcrypto_pbkdf2_count_iters(QCRYPTO_HASH_ALG_SHA256,
|
||||
* iterations = qcrypto_pbkdf2_count_iters(QCRYPTO_HASH_ALGO_SHA256,
|
||||
* (const uint8_t *)password,
|
||||
* strlen(password),
|
||||
* salt, nkey, errp);
|
||||
|
@ -60,7 +60,7 @@
|
|||
* return -1;
|
||||
* }
|
||||
*
|
||||
* if (qcrypto_pbkdf2(QCRYPTO_HASH_ALG_SHA256,
|
||||
* if (qcrypto_pbkdf2(QCRYPTO_HASH_ALGO_SHA256,
|
||||
* (const uint8_t *)password, strlen(password),
|
||||
* salt, nkey, iterations, key, nkey, errp) < 0) {
|
||||
* g_free(key);
|
||||
|
@ -70,7 +70,7 @@
|
|||
*
|
||||
* g_free(salt);
|
||||
*
|
||||
* cipher = qcrypto_cipher_new(QCRYPTO_CIPHER_ALG_AES_128,
|
||||
* cipher = qcrypto_cipher_new(QCRYPTO_CIPHER_ALGO_AES_128,
|
||||
* QCRYPTO_CIPHER_MODE_ECB,
|
||||
* key, nkey, errp);
|
||||
* g_free(key);
|
||||
|
@ -92,7 +92,7 @@
|
|||
*
|
||||
* Returns true if supported, false otherwise
|
||||
*/
|
||||
bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash);
|
||||
bool qcrypto_pbkdf2_supports(QCryptoHashAlgo hash);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -119,7 +119,7 @@ bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash);
|
|||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
||||
int qcrypto_pbkdf2(QCryptoHashAlgo hash,
|
||||
const uint8_t *key, size_t nkey,
|
||||
const uint8_t *salt, size_t nsalt,
|
||||
uint64_t iterations,
|
||||
|
@ -147,7 +147,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
|||
*
|
||||
* Returns: number of iterations in 1 second, -1 on error
|
||||
*/
|
||||
uint64_t qcrypto_pbkdf2_count_iters(QCryptoHashAlgorithm hash,
|
||||
uint64_t qcrypto_pbkdf2_count_iters(QCryptoHashAlgo hash,
|
||||
const uint8_t *key, size_t nkey,
|
||||
const uint8_t *salt, size_t nsalt,
|
||||
size_t nout,
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "crypto/hash.h"
|
||||
|
||||
int qcrypto_get_x509_cert_fingerprint(uint8_t *cert, size_t size,
|
||||
QCryptoHashAlgorithm hash,
|
||||
QCryptoHashAlgo hash,
|
||||
uint8_t *result,
|
||||
size_t *resultlen,
|
||||
Error **errp);
|
||||
|
|
|
@ -88,7 +88,7 @@ extern const PropertyInfo qdev_prop_iothread_vq_mapping_list;
|
|||
|
||||
#define DEFINE_PROP_CPUS390ENTITLEMENT(_n, _s, _f, _d) \
|
||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_cpus390entitlement, \
|
||||
CpuS390Entitlement)
|
||||
S390CpuEntitlement)
|
||||
|
||||
#define DEFINE_PROP_IOTHREAD_VQ_MAPPING_LIST(_name, _state, _field) \
|
||||
DEFINE_PROP(_name, _state, _field, qdev_prop_iothread_vq_mapping_list, \
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct S390TopologyEntry {
|
|||
|
||||
typedef struct S390Topology {
|
||||
uint8_t *cores_per_socket;
|
||||
CpuS390Polarization polarization;
|
||||
S390CpuPolarization polarization;
|
||||
} S390Topology;
|
||||
|
||||
typedef QTAILQ_HEAD(, S390TopologyEntry) S390TopologyList;
|
||||
|
|
|
@ -178,7 +178,7 @@ typedef struct CryptoDevBackendAsymOpInfo {
|
|||
typedef void (*CryptoDevCompletionFunc) (void *opaque, int ret);
|
||||
|
||||
typedef struct CryptoDevBackendOpInfo {
|
||||
QCryptodevBackendAlgType algtype;
|
||||
QCryptodevBackendAlgoType algtype;
|
||||
uint32_t op_code;
|
||||
uint32_t queue_index;
|
||||
CryptoDevCompletionFunc cb;
|
||||
|
|
|
@ -351,7 +351,7 @@ static void qio_channel_websock_handshake_send_res_ok(QIOChannelWebsock *ioc,
|
|||
QIO_CHANNEL_WEBSOCK_GUID_LEN + 1);
|
||||
|
||||
/* hash and encode it */
|
||||
if (qcrypto_hash_base64(QCRYPTO_HASH_ALG_SHA1,
|
||||
if (qcrypto_hash_base64(QCRYPTO_HASH_ALGO_SHA1,
|
||||
combined_key,
|
||||
QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
|
||||
QIO_CHANNEL_WEBSOCK_GUID_LEN,
|
||||
|
|
|
@ -3746,7 +3746,7 @@
|
|||
#
|
||||
# Since: 4.1
|
||||
##
|
||||
{ 'enum': 'BlkdebugIOType', 'prefix': 'BLKDEBUG_IO_TYPE',
|
||||
{ 'enum': 'BlkdebugIOType',
|
||||
'data': [ 'read', 'write', 'write-zeroes', 'discard', 'flush',
|
||||
'block-status' ] }
|
||||
|
||||
|
@ -4163,7 +4163,7 @@
|
|||
##
|
||||
{ 'struct': 'RbdEncryptionCreateOptionsLUKSBase',
|
||||
'base': 'RbdEncryptionOptionsLUKSBase',
|
||||
'data': { '*cipher-alg': 'QCryptoCipherAlgorithm' } }
|
||||
'data': { '*cipher-alg': 'QCryptoCipherAlgo' } }
|
||||
|
||||
##
|
||||
# @RbdEncryptionOptionsLUKS:
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
# Since: 2.5
|
||||
##
|
||||
{ 'enum': 'QCryptoTLSCredsEndpoint',
|
||||
'prefix': 'QCRYPTO_TLS_CREDS_ENDPOINT',
|
||||
'data': ['client', 'server']}
|
||||
|
||||
##
|
||||
|
@ -36,11 +35,10 @@
|
|||
# Since: 2.6
|
||||
##
|
||||
{ 'enum': 'QCryptoSecretFormat',
|
||||
'prefix': 'QCRYPTO_SECRET_FORMAT',
|
||||
'data': ['raw', 'base64']}
|
||||
|
||||
##
|
||||
# @QCryptoHashAlgorithm:
|
||||
# @QCryptoHashAlgo:
|
||||
#
|
||||
# The supported algorithms for computing content digests
|
||||
#
|
||||
|
@ -60,12 +58,11 @@
|
|||
#
|
||||
# Since: 2.6
|
||||
##
|
||||
{ 'enum': 'QCryptoHashAlgorithm',
|
||||
'prefix': 'QCRYPTO_HASH_ALG',
|
||||
{ 'enum': 'QCryptoHashAlgo',
|
||||
'data': ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'ripemd160']}
|
||||
|
||||
##
|
||||
# @QCryptoCipherAlgorithm:
|
||||
# @QCryptoCipherAlgo:
|
||||
#
|
||||
# The supported algorithms for content encryption ciphers
|
||||
#
|
||||
|
@ -98,8 +95,7 @@
|
|||
#
|
||||
# Since: 2.6
|
||||
##
|
||||
{ 'enum': 'QCryptoCipherAlgorithm',
|
||||
'prefix': 'QCRYPTO_CIPHER_ALG',
|
||||
{ 'enum': 'QCryptoCipherAlgo',
|
||||
'data': ['aes-128', 'aes-192', 'aes-256',
|
||||
'des', '3des',
|
||||
'cast5-128',
|
||||
|
@ -123,11 +119,10 @@
|
|||
# Since: 2.6
|
||||
##
|
||||
{ 'enum': 'QCryptoCipherMode',
|
||||
'prefix': 'QCRYPTO_CIPHER_MODE',
|
||||
'data': ['ecb', 'cbc', 'xts', 'ctr']}
|
||||
|
||||
##
|
||||
# @QCryptoIVGenAlgorithm:
|
||||
# @QCryptoIVGenAlgo:
|
||||
#
|
||||
# The supported algorithms for generating initialization vectors for
|
||||
# full disk encryption. The 'plain' generator should not be used for
|
||||
|
@ -143,8 +138,7 @@
|
|||
#
|
||||
# Since: 2.6
|
||||
##
|
||||
{ 'enum': 'QCryptoIVGenAlgorithm',
|
||||
'prefix': 'QCRYPTO_IVGEN_ALG',
|
||||
{ 'enum': 'QCryptoIVGenAlgo',
|
||||
'data': ['plain', 'plain64', 'essiv']}
|
||||
|
||||
##
|
||||
|
@ -160,7 +154,6 @@
|
|||
# Since: 2.6
|
||||
##
|
||||
{ 'enum': 'QCryptoBlockFormat',
|
||||
# 'prefix': 'QCRYPTO_BLOCK_FORMAT',
|
||||
'data': ['qcow', 'luks']}
|
||||
|
||||
##
|
||||
|
@ -230,11 +223,11 @@
|
|||
##
|
||||
{ 'struct': 'QCryptoBlockCreateOptionsLUKS',
|
||||
'base': 'QCryptoBlockOptionsLUKS',
|
||||
'data': { '*cipher-alg': 'QCryptoCipherAlgorithm',
|
||||
'data': { '*cipher-alg': 'QCryptoCipherAlgo',
|
||||
'*cipher-mode': 'QCryptoCipherMode',
|
||||
'*ivgen-alg': 'QCryptoIVGenAlgorithm',
|
||||
'*ivgen-hash-alg': 'QCryptoHashAlgorithm',
|
||||
'*hash-alg': 'QCryptoHashAlgorithm',
|
||||
'*ivgen-alg': 'QCryptoIVGenAlgo',
|
||||
'*ivgen-hash-alg': 'QCryptoHashAlgo',
|
||||
'*hash-alg': 'QCryptoHashAlgo',
|
||||
'*iter-time': 'int' }}
|
||||
|
||||
##
|
||||
|
@ -327,11 +320,11 @@
|
|||
# Since: 2.7
|
||||
##
|
||||
{ 'struct': 'QCryptoBlockInfoLUKS',
|
||||
'data': {'cipher-alg': 'QCryptoCipherAlgorithm',
|
||||
'data': {'cipher-alg': 'QCryptoCipherAlgo',
|
||||
'cipher-mode': 'QCryptoCipherMode',
|
||||
'ivgen-alg': 'QCryptoIVGenAlgorithm',
|
||||
'*ivgen-hash-alg': 'QCryptoHashAlgorithm',
|
||||
'hash-alg': 'QCryptoHashAlgorithm',
|
||||
'ivgen-alg': 'QCryptoIVGenAlgo',
|
||||
'*ivgen-hash-alg': 'QCryptoHashAlgo',
|
||||
'hash-alg': 'QCryptoHashAlgo',
|
||||
'detached-header': 'bool',
|
||||
'payload-offset': 'int',
|
||||
'master-key-iters': 'int',
|
||||
|
@ -593,7 +586,7 @@
|
|||
'*sanity-check': 'bool',
|
||||
'*passwordid': 'str' } }
|
||||
##
|
||||
# @QCryptoAkCipherAlgorithm:
|
||||
# @QCryptoAkCipherAlgo:
|
||||
#
|
||||
# The supported algorithms for asymmetric encryption ciphers
|
||||
#
|
||||
|
@ -601,8 +594,7 @@
|
|||
#
|
||||
# Since: 7.1
|
||||
##
|
||||
{ 'enum': 'QCryptoAkCipherAlgorithm',
|
||||
'prefix': 'QCRYPTO_AKCIPHER_ALG',
|
||||
{ 'enum': 'QCryptoAkCipherAlgo',
|
||||
'data': ['rsa']}
|
||||
|
||||
##
|
||||
|
@ -613,11 +605,10 @@
|
|||
# Since: 7.1
|
||||
##
|
||||
{ 'enum': 'QCryptoAkCipherKeyType',
|
||||
'prefix': 'QCRYPTO_AKCIPHER_KEY_TYPE',
|
||||
'data': ['public', 'private']}
|
||||
|
||||
##
|
||||
# @QCryptoRSAPaddingAlgorithm:
|
||||
# @QCryptoRSAPaddingAlgo:
|
||||
#
|
||||
# The padding algorithm for RSA.
|
||||
#
|
||||
|
@ -627,8 +618,7 @@
|
|||
#
|
||||
# Since: 7.1
|
||||
##
|
||||
{ 'enum': 'QCryptoRSAPaddingAlgorithm',
|
||||
'prefix': 'QCRYPTO_RSA_PADDING_ALG',
|
||||
{ 'enum': 'QCryptoRSAPaddingAlgo',
|
||||
'data': ['raw', 'pkcs1']}
|
||||
|
||||
##
|
||||
|
@ -636,15 +626,15 @@
|
|||
#
|
||||
# Specific parameters for RSA algorithm.
|
||||
#
|
||||
# @hash-alg: QCryptoHashAlgorithm
|
||||
# @hash-alg: QCryptoHashAlgo
|
||||
#
|
||||
# @padding-alg: QCryptoRSAPaddingAlgorithm
|
||||
# @padding-alg: QCryptoRSAPaddingAlgo
|
||||
#
|
||||
# Since: 7.1
|
||||
##
|
||||
{ 'struct': 'QCryptoAkCipherOptionsRSA',
|
||||
'data': { 'hash-alg':'QCryptoHashAlgorithm',
|
||||
'padding-alg': 'QCryptoRSAPaddingAlgorithm'}}
|
||||
'data': { 'hash-alg':'QCryptoHashAlgo',
|
||||
'padding-alg': 'QCryptoRSAPaddingAlgo'}}
|
||||
|
||||
##
|
||||
# @QCryptoAkCipherOptions:
|
||||
|
@ -657,6 +647,6 @@
|
|||
# Since: 7.1
|
||||
##
|
||||
{ 'union': 'QCryptoAkCipherOptions',
|
||||
'base': { 'alg': 'QCryptoAkCipherAlgorithm' },
|
||||
'base': { 'alg': 'QCryptoAkCipherAlgo' },
|
||||
'discriminator': 'alg',
|
||||
'data': { 'rsa': 'QCryptoAkCipherOptionsRSA' }}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
##
|
||||
|
||||
##
|
||||
# @QCryptodevBackendAlgType:
|
||||
# @QCryptodevBackendAlgoType:
|
||||
#
|
||||
# The supported algorithm types of a crypto device.
|
||||
#
|
||||
|
@ -19,8 +19,7 @@
|
|||
#
|
||||
# Since: 8.0
|
||||
##
|
||||
{ 'enum': 'QCryptodevBackendAlgType',
|
||||
'prefix': 'QCRYPTODEV_BACKEND_ALG',
|
||||
{ 'enum': 'QCryptodevBackendAlgoType',
|
||||
'data': ['sym', 'asym']}
|
||||
|
||||
##
|
||||
|
@ -31,7 +30,6 @@
|
|||
# Since: 8.0
|
||||
##
|
||||
{ 'enum': 'QCryptodevBackendServiceType',
|
||||
'prefix': 'QCRYPTODEV_BACKEND_SERVICE',
|
||||
'data': ['cipher', 'hash', 'mac', 'aead', 'akcipher']}
|
||||
|
||||
##
|
||||
|
@ -48,7 +46,6 @@
|
|||
# Since: 8.0
|
||||
##
|
||||
{ 'enum': 'QCryptodevBackendType',
|
||||
'prefix': 'QCRYPTODEV_BACKEND_TYPE',
|
||||
'data': ['builtin', 'vhost-user', 'lkcf']}
|
||||
|
||||
##
|
||||
|
|
|
@ -9,13 +9,12 @@
|
|||
##
|
||||
|
||||
##
|
||||
# @CpuS390Entitlement:
|
||||
# @S390CpuEntitlement:
|
||||
#
|
||||
# An enumeration of CPU entitlements that can be assumed by a virtual
|
||||
# S390 CPU
|
||||
#
|
||||
# Since: 8.2
|
||||
##
|
||||
{ 'enum': 'CpuS390Entitlement',
|
||||
'prefix': 'S390_CPU_ENTITLEMENT',
|
||||
{ 'enum': 'S390CpuEntitlement',
|
||||
'data': [ 'auto', 'low', 'medium', 'high' ] }
|
||||
|
|
|
@ -405,15 +405,14 @@
|
|||
'TARGET_RISCV' ] } }
|
||||
|
||||
##
|
||||
# @CpuS390Polarization:
|
||||
# @S390CpuPolarization:
|
||||
#
|
||||
# An enumeration of CPU polarization that can be assumed by a virtual
|
||||
# S390 CPU
|
||||
#
|
||||
# Since: 8.2
|
||||
##
|
||||
{ 'enum': 'CpuS390Polarization',
|
||||
'prefix': 'S390_CPU_POLARIZATION',
|
||||
{ 'enum': 'S390CpuPolarization',
|
||||
'data': [ 'horizontal', 'vertical' ],
|
||||
'if': 'TARGET_S390X'
|
||||
}
|
||||
|
@ -450,7 +449,7 @@
|
|||
'*socket-id': 'uint16',
|
||||
'*book-id': 'uint16',
|
||||
'*drawer-id': 'uint16',
|
||||
'*entitlement': 'CpuS390Entitlement',
|
||||
'*entitlement': 'S390CpuEntitlement',
|
||||
'*dedicated': 'bool'
|
||||
},
|
||||
'features': [ 'unstable' ],
|
||||
|
@ -488,7 +487,7 @@
|
|||
# "timestamp": { "seconds": 1401385907, "microseconds": 422329 } }
|
||||
##
|
||||
{ 'event': 'CPU_POLARIZATION_CHANGE',
|
||||
'data': { 'polarization': 'CpuS390Polarization' },
|
||||
'data': { 'polarization': 'S390CpuPolarization' },
|
||||
'features': [ 'unstable' ],
|
||||
'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
|
||||
}
|
||||
|
@ -503,7 +502,7 @@
|
|||
# Since: 8.2
|
||||
##
|
||||
{ 'struct': 'CpuPolarizationInfo',
|
||||
'data': { 'polarization': 'CpuS390Polarization' },
|
||||
'data': { 'polarization': 'S390CpuPolarization' },
|
||||
'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
|
||||
}
|
||||
|
||||
|
|
|
@ -41,15 +41,14 @@
|
|||
'x86_64', 'xtensa', 'xtensaeb' ] }
|
||||
|
||||
##
|
||||
# @CpuS390State:
|
||||
# @S390CpuState:
|
||||
#
|
||||
# An enumeration of cpu states that can be assumed by a virtual S390
|
||||
# CPU
|
||||
#
|
||||
# Since: 2.12
|
||||
##
|
||||
{ 'enum': 'CpuS390State',
|
||||
'prefix': 'S390_CPU_STATE',
|
||||
{ 'enum': 'S390CpuState',
|
||||
'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] }
|
||||
|
||||
##
|
||||
|
@ -66,9 +65,9 @@
|
|||
# Since: 2.12
|
||||
##
|
||||
{ 'struct': 'CpuInfoS390',
|
||||
'data': { 'cpu-state': 'CpuS390State',
|
||||
'data': { 'cpu-state': 'S390CpuState',
|
||||
'*dedicated': 'bool',
|
||||
'*entitlement': 'CpuS390Entitlement' } }
|
||||
'*entitlement': 'S390CpuEntitlement' } }
|
||||
|
||||
##
|
||||
# @CpuInfoFast:
|
||||
|
|
|
@ -573,6 +573,7 @@
|
|||
# Since: 5.0
|
||||
##
|
||||
{ 'enum': 'MultiFDCompression',
|
||||
'prefix': 'MULTIFD_COMPRESSION',
|
||||
'data': [ 'none', 'zlib',
|
||||
{ 'name': 'zstd', 'if': 'CONFIG_ZSTD' },
|
||||
{ 'name': 'qatzip', 'if': 'CONFIG_QATZIP'},
|
||||
|
|
|
@ -47,9 +47,6 @@
|
|||
'BlockdevSnapshotWrapper',
|
||||
'BlockdevVmdkAdapterType',
|
||||
'ChardevBackendKind',
|
||||
'CpuS390Entitlement',
|
||||
'CpuS390Polarization',
|
||||
'CpuS390State',
|
||||
'CxlCorErrorType',
|
||||
'DisplayProtocol',
|
||||
'DriveBackupWrapper',
|
||||
|
@ -74,6 +71,9 @@
|
|||
'QKeyCode',
|
||||
'RbdAuthMode',
|
||||
'RbdImageEncryptionFormat',
|
||||
'S390CpuEntitlement',
|
||||
'S390CpuPolarization',
|
||||
'S390CpuState',
|
||||
'String',
|
||||
'StringWrapper',
|
||||
'SysEmuTarget',
|
||||
|
|
|
@ -949,6 +949,7 @@
|
|||
# Since: 1.3
|
||||
##
|
||||
{ 'enum': 'QKeyCode',
|
||||
'prefix': 'Q_KEY_CODE',
|
||||
'data': [ 'unmapped',
|
||||
'shift', 'shift_r', 'alt', 'alt_r', 'ctrl',
|
||||
'ctrl_r', 'menu', 'esc', '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
##
|
||||
|
||||
##
|
||||
# @VfioMigrationState:
|
||||
# @QapiVfioMigrationState:
|
||||
#
|
||||
# An enumeration of the VFIO device migration states.
|
||||
#
|
||||
|
@ -32,10 +32,9 @@
|
|||
#
|
||||
# Since: 9.1
|
||||
##
|
||||
{ 'enum': 'VfioMigrationState',
|
||||
{ 'enum': 'QapiVfioMigrationState',
|
||||
'data': [ 'stop', 'running', 'stop-copy', 'resuming', 'running-p2p',
|
||||
'pre-copy', 'pre-copy-p2p' ],
|
||||
'prefix': 'QAPI_VFIO_MIGRATION_STATE' }
|
||||
'pre-copy', 'pre-copy-p2p' ] }
|
||||
|
||||
##
|
||||
# @VFIO_MIGRATION:
|
||||
|
@ -63,5 +62,5 @@
|
|||
'data': {
|
||||
'device-id': 'str',
|
||||
'qom-path': 'str',
|
||||
'device-state': 'VfioMigrationState'
|
||||
'device-state': 'QapiVfioMigrationState'
|
||||
} }
|
||||
|
|
|
@ -40,22 +40,28 @@ def camel_to_upper(value: str) -> str:
|
|||
ENUM_Name2 -> ENUM_NAME2
|
||||
ENUM24_Name -> ENUM24_NAME
|
||||
"""
|
||||
c_fun_str = c_name(value, False)
|
||||
if value.isupper():
|
||||
return c_fun_str
|
||||
ret = value[0]
|
||||
upc = value[0].isupper()
|
||||
|
||||
new_name = ''
|
||||
length = len(c_fun_str)
|
||||
for i in range(length):
|
||||
char = c_fun_str[i]
|
||||
# When char is upper case and no '_' appears before, do more checks
|
||||
if char.isupper() and (i > 0) and c_fun_str[i - 1] != '_':
|
||||
if i < length - 1 and c_fun_str[i + 1].islower():
|
||||
new_name += '_'
|
||||
elif c_fun_str[i - 1].isdigit():
|
||||
new_name += '_'
|
||||
new_name += char
|
||||
return new_name.lstrip('_').upper()
|
||||
# Copy remainder of ``value`` to ``ret`` with '_' inserted
|
||||
for ch in value[1:]:
|
||||
if ch.isupper() == upc:
|
||||
pass
|
||||
elif upc:
|
||||
# ``ret`` ends in upper case, next char isn't: insert '_'
|
||||
# before the last upper case char unless there is one
|
||||
# already, or it's at the beginning
|
||||
if len(ret) > 2 and ret[-2].isalnum():
|
||||
ret = ret[:-1] + '_' + ret[-1]
|
||||
else:
|
||||
# ``ret`` doesn't end in upper case, next char is: insert
|
||||
# '_' before it
|
||||
if ret[-1].isalnum():
|
||||
ret += '_'
|
||||
ret += ch
|
||||
upc = ch.isupper()
|
||||
|
||||
return c_name(ret.upper()).lstrip('_')
|
||||
|
||||
|
||||
def c_enum_const(type_name: str,
|
||||
|
@ -68,9 +74,9 @@ def c_enum_const(type_name: str,
|
|||
:param const_name: The name of this constant.
|
||||
:param prefix: Optional, prefix that overrides the type_name.
|
||||
"""
|
||||
if prefix is not None:
|
||||
type_name = prefix
|
||||
return camel_to_upper(type_name) + '_' + c_name(const_name, False).upper()
|
||||
if prefix is None:
|
||||
prefix = camel_to_upper(type_name)
|
||||
return prefix + '_' + c_name(const_name, False).upper()
|
||||
|
||||
|
||||
def c_name(name: str, protect: bool = True) -> str:
|
||||
|
|
|
@ -1249,7 +1249,7 @@ class QAPISchema:
|
|||
[{'name': n} for n in qtypes], None)
|
||||
|
||||
self._def_definition(QAPISchemaEnumType(
|
||||
'QType', None, None, None, None, qtype_values, 'QTYPE'))
|
||||
'QType', None, None, None, None, qtype_values, None))
|
||||
|
||||
def _make_features(
|
||||
self,
|
||||
|
|
|
@ -1971,7 +1971,7 @@ static void qemu_create_early_backends(void)
|
|||
|
||||
qemu_console_early_init();
|
||||
|
||||
if (dpy.has_gl && dpy.gl != DISPLAYGL_MODE_OFF && display_opengl == 0) {
|
||||
if (dpy.has_gl && dpy.gl != DISPLAY_GL_MODE_OFF && display_opengl == 0) {
|
||||
#if defined(CONFIG_OPENGL)
|
||||
error_report("OpenGL is not supported by display backend '%s'",
|
||||
DisplayType_str(dpy.type));
|
||||
|
|
|
@ -1883,7 +1883,7 @@ static bool build_kernel_loader_hashes(PaddedSevHashTable *padded_ht,
|
|||
* be used.
|
||||
*/
|
||||
hashp = cmdline_hash;
|
||||
if (qcrypto_hash_bytes(QCRYPTO_HASH_ALG_SHA256, ctx->cmdline_data,
|
||||
if (qcrypto_hash_bytes(QCRYPTO_HASH_ALGO_SHA256, ctx->cmdline_data,
|
||||
ctx->cmdline_size, &hashp, &hash_len, errp) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1894,7 +1894,7 @@ static bool build_kernel_loader_hashes(PaddedSevHashTable *padded_ht,
|
|||
* -initrd, an empty buffer will be used (ctx->initrd_size == 0).
|
||||
*/
|
||||
hashp = initrd_hash;
|
||||
if (qcrypto_hash_bytes(QCRYPTO_HASH_ALG_SHA256, ctx->initrd_data,
|
||||
if (qcrypto_hash_bytes(QCRYPTO_HASH_ALGO_SHA256, ctx->initrd_data,
|
||||
ctx->initrd_size, &hashp, &hash_len, errp) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1906,7 +1906,7 @@ static bool build_kernel_loader_hashes(PaddedSevHashTable *padded_ht,
|
|||
{ .iov_base = ctx->setup_data, .iov_len = ctx->setup_size },
|
||||
{ .iov_base = ctx->kernel_data, .iov_len = ctx->kernel_size }
|
||||
};
|
||||
if (qcrypto_hash_bytesv(QCRYPTO_HASH_ALG_SHA256, iov, ARRAY_SIZE(iov),
|
||||
if (qcrypto_hash_bytesv(QCRYPTO_HASH_ALGO_SHA256, iov, ARRAY_SIZE(iov),
|
||||
&hashp, &hash_len, errp) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ typedef struct CPUArchState {
|
|||
int32_t book_id;
|
||||
int32_t drawer_id;
|
||||
bool dedicated;
|
||||
CpuS390Entitlement entitlement; /* Used only for vertical polarization */
|
||||
S390CpuEntitlement entitlement; /* Used only for vertical polarization */
|
||||
uint64_t cpuid;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
|
||||
static QCryptoAkCipher *create_rsa_akcipher(const uint8_t *priv_key,
|
||||
size_t keylen,
|
||||
QCryptoRSAPaddingAlgorithm padding,
|
||||
QCryptoHashAlgorithm hash)
|
||||
QCryptoRSAPaddingAlgo padding,
|
||||
QCryptoHashAlgo hash)
|
||||
{
|
||||
QCryptoAkCipherOptions opt;
|
||||
|
||||
opt.alg = QCRYPTO_AKCIPHER_ALG_RSA;
|
||||
opt.alg = QCRYPTO_AK_CIPHER_ALGO_RSA;
|
||||
opt.u.rsa.padding_alg = padding;
|
||||
opt.u.rsa.hash_alg = hash;
|
||||
return qcrypto_akcipher_new(&opt, QCRYPTO_AKCIPHER_KEY_TYPE_PRIVATE,
|
||||
return qcrypto_akcipher_new(&opt, QCRYPTO_AK_CIPHER_KEY_TYPE_PRIVATE,
|
||||
priv_key, keylen, &error_abort);
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ static void test_rsa_speed(const uint8_t *priv_key, size_t keylen,
|
|||
#define SHA1_DGST_LEN 20
|
||||
#define SIGN_TIMES 10000
|
||||
#define VERIFY_TIMES 100000
|
||||
#define PADDING QCRYPTO_RSA_PADDING_ALG_PKCS1
|
||||
#define HASH QCRYPTO_HASH_ALG_SHA1
|
||||
#define PADDING QCRYPTO_RSA_PADDING_ALGO_PKCS1
|
||||
#define HASH QCRYPTO_HASH_ALGO_SHA1
|
||||
|
||||
g_autoptr(QCryptoAkCipher) rsa =
|
||||
create_rsa_akcipher(priv_key, keylen, PADDING, HASH);
|
||||
|
@ -53,8 +53,8 @@ static void test_rsa_speed(const uint8_t *priv_key, size_t keylen,
|
|||
signature = g_new0(uint8_t, key_size / BYTE);
|
||||
|
||||
g_test_message("benchmark rsa%zu (%s-%s) sign...", key_size,
|
||||
QCryptoRSAPaddingAlgorithm_str(PADDING),
|
||||
QCryptoHashAlgorithm_str(HASH));
|
||||
QCryptoRSAPaddingAlgo_str(PADDING),
|
||||
QCryptoHashAlgo_str(HASH));
|
||||
g_test_timer_start();
|
||||
for (count = 0; count < SIGN_TIMES; ++count) {
|
||||
g_assert(qcrypto_akcipher_sign(rsa, dgst, SHA1_DGST_LEN,
|
||||
|
@ -64,14 +64,14 @@ static void test_rsa_speed(const uint8_t *priv_key, size_t keylen,
|
|||
g_test_timer_elapsed();
|
||||
g_test_message("rsa%zu (%s-%s) sign %zu times in %.2f seconds,"
|
||||
" %.2f times/sec ",
|
||||
key_size, QCryptoRSAPaddingAlgorithm_str(PADDING),
|
||||
QCryptoHashAlgorithm_str(HASH),
|
||||
key_size, QCryptoRSAPaddingAlgo_str(PADDING),
|
||||
QCryptoHashAlgo_str(HASH),
|
||||
count, g_test_timer_last(),
|
||||
(double)count / g_test_timer_last());
|
||||
|
||||
g_test_message("benchmark rsa%zu (%s-%s) verification...", key_size,
|
||||
QCryptoRSAPaddingAlgorithm_str(PADDING),
|
||||
QCryptoHashAlgorithm_str(HASH));
|
||||
QCryptoRSAPaddingAlgo_str(PADDING),
|
||||
QCryptoHashAlgo_str(HASH));
|
||||
g_test_timer_start();
|
||||
for (count = 0; count < VERIFY_TIMES; ++count) {
|
||||
g_assert(qcrypto_akcipher_verify(rsa, signature, key_size / BYTE,
|
||||
|
@ -81,8 +81,8 @@ static void test_rsa_speed(const uint8_t *priv_key, size_t keylen,
|
|||
g_test_timer_elapsed();
|
||||
g_test_message("rsa%zu (%s-%s) verify %zu times in %.2f seconds,"
|
||||
" %.2f times/sec ",
|
||||
key_size, QCryptoRSAPaddingAlgorithm_str(PADDING),
|
||||
QCryptoHashAlgorithm_str(HASH),
|
||||
key_size, QCryptoRSAPaddingAlgo_str(PADDING),
|
||||
QCryptoHashAlgo_str(HASH),
|
||||
count, g_test_timer_last(),
|
||||
(double)count / g_test_timer_last());
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
static void test_cipher_speed(size_t chunk_size,
|
||||
QCryptoCipherMode mode,
|
||||
QCryptoCipherAlgorithm alg)
|
||||
QCryptoCipherAlgo alg)
|
||||
{
|
||||
QCryptoCipher *cipher;
|
||||
Error *err = NULL;
|
||||
|
@ -71,7 +71,7 @@ static void test_cipher_speed(size_t chunk_size,
|
|||
g_test_timer_elapsed();
|
||||
|
||||
g_test_message("enc(%s-%s) chunk %zu bytes %.2f MB/sec ",
|
||||
QCryptoCipherAlgorithm_str(alg),
|
||||
QCryptoCipherAlgo_str(alg),
|
||||
QCryptoCipherMode_str(mode),
|
||||
chunk_size, (double)total / MiB / g_test_timer_last());
|
||||
|
||||
|
@ -88,7 +88,7 @@ static void test_cipher_speed(size_t chunk_size,
|
|||
g_test_timer_elapsed();
|
||||
|
||||
g_test_message("dec(%s-%s) chunk %zu bytes %.2f MB/sec ",
|
||||
QCryptoCipherAlgorithm_str(alg),
|
||||
QCryptoCipherAlgo_str(alg),
|
||||
QCryptoCipherMode_str(mode),
|
||||
chunk_size, (double)total / MiB / g_test_timer_last());
|
||||
|
||||
|
@ -105,7 +105,7 @@ static void test_cipher_speed_ecb_aes_128(const void *opaque)
|
|||
size_t chunk_size = (size_t)opaque;
|
||||
test_cipher_speed(chunk_size,
|
||||
QCRYPTO_CIPHER_MODE_ECB,
|
||||
QCRYPTO_CIPHER_ALG_AES_128);
|
||||
QCRYPTO_CIPHER_ALGO_AES_128);
|
||||
}
|
||||
|
||||
static void test_cipher_speed_ecb_aes_256(const void *opaque)
|
||||
|
@ -113,7 +113,7 @@ static void test_cipher_speed_ecb_aes_256(const void *opaque)
|
|||
size_t chunk_size = (size_t)opaque;
|
||||
test_cipher_speed(chunk_size,
|
||||
QCRYPTO_CIPHER_MODE_ECB,
|
||||
QCRYPTO_CIPHER_ALG_AES_256);
|
||||
QCRYPTO_CIPHER_ALGO_AES_256);
|
||||
}
|
||||
|
||||
static void test_cipher_speed_cbc_aes_128(const void *opaque)
|
||||
|
@ -121,7 +121,7 @@ static void test_cipher_speed_cbc_aes_128(const void *opaque)
|
|||
size_t chunk_size = (size_t)opaque;
|
||||
test_cipher_speed(chunk_size,
|
||||
QCRYPTO_CIPHER_MODE_CBC,
|
||||
QCRYPTO_CIPHER_ALG_AES_128);
|
||||
QCRYPTO_CIPHER_ALGO_AES_128);
|
||||
}
|
||||
|
||||
static void test_cipher_speed_cbc_aes_256(const void *opaque)
|
||||
|
@ -129,7 +129,7 @@ static void test_cipher_speed_cbc_aes_256(const void *opaque)
|
|||
size_t chunk_size = (size_t)opaque;
|
||||
test_cipher_speed(chunk_size,
|
||||
QCRYPTO_CIPHER_MODE_CBC,
|
||||
QCRYPTO_CIPHER_ALG_AES_256);
|
||||
QCRYPTO_CIPHER_ALGO_AES_256);
|
||||
}
|
||||
|
||||
static void test_cipher_speed_ctr_aes_128(const void *opaque)
|
||||
|
@ -137,7 +137,7 @@ static void test_cipher_speed_ctr_aes_128(const void *opaque)
|
|||
size_t chunk_size = (size_t)opaque;
|
||||
test_cipher_speed(chunk_size,
|
||||
QCRYPTO_CIPHER_MODE_CTR,
|
||||
QCRYPTO_CIPHER_ALG_AES_128);
|
||||
QCRYPTO_CIPHER_ALGO_AES_128);
|
||||
}
|
||||
|
||||
static void test_cipher_speed_ctr_aes_256(const void *opaque)
|
||||
|
@ -145,7 +145,7 @@ static void test_cipher_speed_ctr_aes_256(const void *opaque)
|
|||
size_t chunk_size = (size_t)opaque;
|
||||
test_cipher_speed(chunk_size,
|
||||
QCRYPTO_CIPHER_MODE_CTR,
|
||||
QCRYPTO_CIPHER_ALG_AES_256);
|
||||
QCRYPTO_CIPHER_ALGO_AES_256);
|
||||
}
|
||||
|
||||
static void test_cipher_speed_xts_aes_128(const void *opaque)
|
||||
|
@ -153,7 +153,7 @@ static void test_cipher_speed_xts_aes_128(const void *opaque)
|
|||
size_t chunk_size = (size_t)opaque;
|
||||
test_cipher_speed(chunk_size,
|
||||
QCRYPTO_CIPHER_MODE_XTS,
|
||||
QCRYPTO_CIPHER_ALG_AES_128);
|
||||
QCRYPTO_CIPHER_ALGO_AES_128);
|
||||
}
|
||||
|
||||
static void test_cipher_speed_xts_aes_256(const void *opaque)
|
||||
|
@ -161,7 +161,7 @@ static void test_cipher_speed_xts_aes_256(const void *opaque)
|
|||
size_t chunk_size = (size_t)opaque;
|
||||
test_cipher_speed(chunk_size,
|
||||
QCRYPTO_CIPHER_MODE_XTS,
|
||||
QCRYPTO_CIPHER_ALG_AES_256);
|
||||
QCRYPTO_CIPHER_ALGO_AES_256);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
typedef struct QCryptoHashOpts {
|
||||
size_t chunk_size;
|
||||
QCryptoHashAlgorithm alg;
|
||||
QCryptoHashAlgo alg;
|
||||
} QCryptoHashOpts;
|
||||
|
||||
static void test_hash_speed(const void *opaque)
|
||||
|
@ -49,7 +49,7 @@ static void test_hash_speed(const void *opaque)
|
|||
g_test_timer_elapsed();
|
||||
|
||||
g_test_message("hash(%s): chunk %zu bytes %.2f MB/sec",
|
||||
QCryptoHashAlgorithm_str(opts->alg),
|
||||
QCryptoHashAlgo_str(opts->alg),
|
||||
opts->chunk_size, total / g_test_timer_last());
|
||||
|
||||
g_free(out);
|
||||
|
@ -65,14 +65,14 @@ int main(int argc, char **argv)
|
|||
|
||||
#define TEST_ONE(a, c) \
|
||||
QCryptoHashOpts opts ## a ## c = { \
|
||||
.alg = QCRYPTO_HASH_ALG_ ## a, .chunk_size = c, \
|
||||
.alg = QCRYPTO_HASH_ALGO_ ## a, .chunk_size = c, \
|
||||
}; \
|
||||
memset(name, 0 , sizeof(name)); \
|
||||
snprintf(name, sizeof(name), \
|
||||
"/crypto/benchmark/hash/%s/bufsize-%d", \
|
||||
QCryptoHashAlgorithm_str(QCRYPTO_HASH_ALG_ ## a), \
|
||||
QCryptoHashAlgo_str(QCRYPTO_HASH_ALGO_ ## a), \
|
||||
c); \
|
||||
if (qcrypto_hash_supports(QCRYPTO_HASH_ALG_ ## a)) \
|
||||
if (qcrypto_hash_supports(QCRYPTO_HASH_ALGO_ ## a)) \
|
||||
g_test_add_data_func(name, \
|
||||
&opts ## a ## c, \
|
||||
test_hash_speed);
|
||||
|
|
|
@ -28,7 +28,7 @@ static void test_hmac_speed(const void *opaque)
|
|||
Error *err = NULL;
|
||||
int ret;
|
||||
|
||||
if (!qcrypto_hmac_supports(QCRYPTO_HASH_ALG_SHA256)) {
|
||||
if (!qcrypto_hmac_supports(QCRYPTO_HASH_ALGO_SHA256)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ static void test_hmac_speed(const void *opaque)
|
|||
|
||||
g_test_timer_start();
|
||||
do {
|
||||
hmac = qcrypto_hmac_new(QCRYPTO_HASH_ALG_SHA256,
|
||||
hmac = qcrypto_hmac_new(QCRYPTO_HASH_ALGO_SHA256,
|
||||
(const uint8_t *)KEY, strlen(KEY), &err);
|
||||
g_assert(err == NULL);
|
||||
g_assert(hmac != NULL);
|
||||
|
@ -56,7 +56,7 @@ static void test_hmac_speed(const void *opaque)
|
|||
|
||||
total /= MiB;
|
||||
g_test_message("hmac(%s): chunk %zu bytes %.2f MB/sec",
|
||||
QCryptoHashAlgorithm_str(QCRYPTO_HASH_ALG_SHA256),
|
||||
QCryptoHashAlgo_str(QCRYPTO_HASH_ALGO_SHA256),
|
||||
chunk_size, total / g_test_timer_last());
|
||||
|
||||
g_free(out);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module ./builtin
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
member none
|
||||
member qnull
|
||||
member qnum
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module ./builtin
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
member none
|
||||
member qnull
|
||||
member qnum
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module ./builtin
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
member none
|
||||
member qnull
|
||||
member qnum
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module ./builtin
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
member none
|
||||
member qnull
|
||||
member qnum
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module ./builtin
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
member none
|
||||
member qnull
|
||||
member qnum
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module ./builtin
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
member none
|
||||
member qnull
|
||||
member qnum
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module ./builtin
|
||||
object q_empty
|
||||
enum QType
|
||||
prefix QTYPE
|
||||
member none
|
||||
member qnull
|
||||
member qnum
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue