Home
last modified time | relevance | path

Searched refs:alg (Results 1 – 25 of 55) sorted by relevance

123

/qemu/crypto/
H A Dcipher.c74 assert(alg < G_N_ELEMENTS(alg_key_len)); in qcrypto_cipher_get_block_len()
75 return alg_block_len[alg]; in qcrypto_cipher_get_block_len()
81 assert(alg < G_N_ELEMENTS(alg_key_len)); in qcrypto_cipher_get_key_len()
82 return alg_key_len[alg]; in qcrypto_cipher_get_key_len()
89 if (alg >= G_N_ELEMENTS(alg_block_len)) { in qcrypto_cipher_get_iv_len()
97 return alg_block_len[alg]; in qcrypto_cipher_get_iv_len()
111 alg); in qcrypto_cipher_validate_key_length()
116 if (alg == QCRYPTO_CIPHER_ALGO_DES || in qcrypto_cipher_validate_key_length()
126 if (alg_key_len[alg] != (nkey / 2)) { in qcrypto_cipher_validate_key_length()
132 if (alg_key_len[alg] != nkey) { in qcrypto_cipher_validate_key_length()
[all …]
H A Dhash-afalg.c24 qcrypto_afalg_hash_format_name(QCryptoHashAlgo alg, in qcrypto_afalg_hash_format_name() argument
31 switch (alg) { in qcrypto_afalg_hash_format_name()
69 qcrypto_afalg_hash_hmac_ctx_new(QCryptoHashAlgo alg, in qcrypto_afalg_hash_hmac_ctx_new() argument
103 qcrypto_afalg_hash_ctx_new(QCryptoHashAlgo alg, in qcrypto_afalg_hash_ctx_new() argument
110 qcrypto_afalg_hmac_ctx_new(QCryptoHashAlgo alg, in qcrypto_afalg_hmac_ctx_new() argument
125 error_setg(errp, "Unknown hash algorithm %d", alg); in qcrypto_afalg_hash_new()
132 hash->alg = alg; in qcrypto_afalg_hash_new()
133 hash->opaque = qcrypto_afalg_hash_ctx_new(alg, errp); in qcrypto_afalg_hash_new()
187 QCryptoHashAlgo alg, in qcrypto_afalg_recv_from_kernel() argument
194 const int expected_len = qcrypto_hash_digest_len(alg); in qcrypto_afalg_recv_from_kernel()
[all …]
H A Dhash.c41 size_t qcrypto_hash_digest_len(QCryptoHashAlgo alg) in qcrypto_hash_digest_len() argument
43 assert(alg < G_N_ELEMENTS(qcrypto_hash_alg_size)); in qcrypto_hash_digest_len()
44 return qcrypto_hash_alg_size[alg]; in qcrypto_hash_digest_len()
47 int qcrypto_hash_bytesv(QCryptoHashAlgo alg, in qcrypto_hash_bytesv() argument
69 int qcrypto_hash_bytes(QCryptoHashAlgo alg, in qcrypto_hash_bytes() argument
105 if (!qcrypto_hash_supports(alg)) { in qcrypto_hash_new()
107 QCryptoHashAlgo_str(alg)); in qcrypto_hash_new()
188 int qcrypto_hash_digestv(QCryptoHashAlgo alg, in qcrypto_hash_digestv() argument
208 int qcrypto_hash_digest(QCryptoHashAlgo alg, in qcrypto_hash_digest() argument
219 int qcrypto_hash_base64v(QCryptoHashAlgo alg, in qcrypto_hash_base64v() argument
[all …]
H A Dhmac-nettle.c105 bool qcrypto_hmac_supports(QCryptoHashAlgo alg) in qcrypto_hmac_supports() argument
107 if (alg < G_N_ELEMENTS(qcrypto_hmac_alg_map) && in qcrypto_hmac_supports()
108 qcrypto_hmac_alg_map[alg].setkey != NULL) { in qcrypto_hmac_supports()
115 void *qcrypto_hmac_ctx_new(QCryptoHashAlgo alg, in qcrypto_hmac_ctx_new() argument
121 if (!qcrypto_hmac_supports(alg)) { in qcrypto_hmac_ctx_new()
123 QCryptoHashAlgo_str(alg)); in qcrypto_hmac_ctx_new()
129 qcrypto_hmac_alg_map[alg].setkey(&ctx->u, nkey, key); in qcrypto_hmac_ctx_new()
161 qcrypto_hmac_alg_map[hmac->alg].update(&ctx->u, len, base); in qcrypto_nettle_hmac_bytesv()
168 *resultlen = qcrypto_hmac_alg_map[hmac->alg].len; in qcrypto_nettle_hmac_bytesv()
170 } else if (*resultlen != qcrypto_hmac_alg_map[hmac->alg].len) { in qcrypto_nettle_hmac_bytesv()
[all …]
H A Dhmac-gnutls.c38 bool qcrypto_hmac_supports(QCryptoHashAlgo alg) in qcrypto_hmac_supports() argument
42 if (alg >= G_N_ELEMENTS(qcrypto_hmac_alg_map) || in qcrypto_hmac_supports()
43 qcrypto_hmac_alg_map[alg] == GNUTLS_DIG_UNKNOWN) { in qcrypto_hmac_supports()
48 if (algs[i] == qcrypto_hmac_alg_map[alg]) { in qcrypto_hmac_supports()
55 void *qcrypto_hmac_ctx_new(QCryptoHashAlgo alg, in qcrypto_hmac_ctx_new() argument
62 if (!qcrypto_hmac_supports(alg)) { in qcrypto_hmac_ctx_new()
64 QCryptoHashAlgo_str(alg)); in qcrypto_hmac_ctx_new()
71 qcrypto_hmac_alg_map[alg], in qcrypto_hmac_ctx_new()
115 ret = gnutls_hmac_get_len(qcrypto_hmac_alg_map[hmac->alg]); in qcrypto_gnutls_hmac_bytesv()
H A Dhash-gcrypt.c42 gboolean qcrypto_hash_supports(QCryptoHashAlgo alg) in qcrypto_hash_supports() argument
44 if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map) && in qcrypto_hash_supports()
45 qcrypto_hash_alg_map[alg] != GCRY_MD_NONE) { in qcrypto_hash_supports()
46 return gcry_md_test_algo(qcrypto_hash_alg_map[alg]) == 0; in qcrypto_hash_supports()
52 QCryptoHash *qcrypto_gcrypt_hash_new(QCryptoHashAlgo alg, Error **errp) in qcrypto_gcrypt_hash_new() argument
58 hash->alg = alg; in qcrypto_gcrypt_hash_new()
62 qcrypto_hash_alg_map[alg], 0); in qcrypto_gcrypt_hash_new()
113 ret = gcry_md_get_algo_dlen(qcrypto_hash_alg_map[hash->alg]); in qcrypto_gcrypt_hash_finalize()
H A Dhash-gnutls.c39 gboolean qcrypto_hash_supports(QCryptoHashAlgo alg) in qcrypto_hash_supports() argument
43 if (alg >= G_N_ELEMENTS(qcrypto_hash_alg_map) || in qcrypto_hash_supports()
44 qcrypto_hash_alg_map[alg] == GNUTLS_DIG_UNKNOWN) { in qcrypto_hash_supports()
49 if (algs[i] == qcrypto_hash_alg_map[alg]) { in qcrypto_hash_supports()
57 QCryptoHash *qcrypto_gnutls_hash_new(QCryptoHashAlgo alg, Error **errp) in qcrypto_gnutls_hash_new() argument
63 hash->alg = alg; in qcrypto_gnutls_hash_new()
66 ret = gnutls_hash_init(hash->opaque, qcrypto_hash_alg_map[alg]); in qcrypto_gnutls_hash_new()
120 ret = gnutls_hash_get_len(qcrypto_hash_alg_map[hash->alg]); in qcrypto_gnutls_hash_finalize()
H A Dhash-glib.c38 gboolean qcrypto_hash_supports(QCryptoHashAlgo alg) in qcrypto_hash_supports() argument
40 if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map) && in qcrypto_hash_supports()
41 qcrypto_hash_alg_map[alg] != -1) { in qcrypto_hash_supports()
48 QCryptoHash *qcrypto_glib_hash_new(QCryptoHashAlgo alg, in qcrypto_glib_hash_new() argument
54 hash->alg = alg; in qcrypto_glib_hash_new()
55 hash->opaque = g_checksum_new(qcrypto_hash_alg_map[alg]); in qcrypto_glib_hash_new()
95 ret = g_checksum_type_get_length(qcrypto_hash_alg_map[hash->alg]); in qcrypto_glib_hash_finalize()
H A Dhmac-gcrypt.c39 bool qcrypto_hmac_supports(QCryptoHashAlgo alg) in qcrypto_hmac_supports() argument
41 if (alg < G_N_ELEMENTS(qcrypto_hmac_alg_map) && in qcrypto_hmac_supports()
42 qcrypto_hmac_alg_map[alg] != GCRY_MAC_NONE) { in qcrypto_hmac_supports()
43 return gcry_mac_test_algo(qcrypto_hmac_alg_map[alg]) == 0; in qcrypto_hmac_supports()
49 void *qcrypto_hmac_ctx_new(QCryptoHashAlgo alg, in qcrypto_hmac_ctx_new() argument
56 if (!qcrypto_hmac_supports(alg)) { in qcrypto_hmac_ctx_new()
58 QCryptoHashAlgo_str(alg)); in qcrypto_hmac_ctx_new()
64 err = gcry_mac_open(&ctx->handle, qcrypto_hmac_alg_map[alg], in qcrypto_hmac_ctx_new()
117 ret = gcry_mac_get_algo_maclen(qcrypto_hmac_alg_map[hmac->alg]); in qcrypto_gcrypt_hmac_bytesv()
H A Dhmac-glib.c35 bool qcrypto_hmac_supports(QCryptoHashAlgo alg) in qcrypto_hmac_supports() argument
37 if (alg < G_N_ELEMENTS(qcrypto_hmac_alg_map) && in qcrypto_hmac_supports()
38 qcrypto_hmac_alg_map[alg] != -1) { in qcrypto_hmac_supports()
45 void *qcrypto_hmac_ctx_new(QCryptoHashAlgo alg, in qcrypto_hmac_ctx_new() argument
51 if (!qcrypto_hmac_supports(alg)) { in qcrypto_hmac_ctx_new()
53 QCryptoHashAlgo_str(alg)); in qcrypto_hmac_ctx_new()
59 ctx->ghmac = g_hmac_new(qcrypto_hmac_alg_map[alg], in qcrypto_hmac_ctx_new()
101 ret = g_checksum_type_get_length(qcrypto_hmac_alg_map[hmac->alg]); in qcrypto_glib_hmac_bytesv()
H A Dhash-nettle.c112 gboolean qcrypto_hash_supports(QCryptoHashAlgo alg) in qcrypto_hash_supports() argument
114 if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map) && in qcrypto_hash_supports()
115 qcrypto_hash_alg_map[alg].init != NULL) { in qcrypto_hash_supports()
122 QCryptoHash *qcrypto_nettle_hash_new(QCryptoHashAlgo alg, Error **errp) in qcrypto_nettle_hash_new() argument
127 hash->alg = alg; in qcrypto_nettle_hash_new()
130 qcrypto_hash_alg_map[alg].init(hash->opaque); in qcrypto_nettle_hash_new()
152 qcrypto_hash_alg_map[hash->alg].write(ctx, in qcrypto_nettle_hash_update()
167 int ret = qcrypto_hash_alg_map[hash->alg].len; in qcrypto_nettle_hash_finalize()
179 qcrypto_hash_alg_map[hash->alg].result(ctx, *result_len, *result); in qcrypto_nettle_hash_finalize()
H A Dx509-utils.c29 QCryptoHashAlgo alg, in qcrypto_get_x509_cert_fingerprint() argument
39 if (alg >= G_N_ELEMENTS(qcrypto_to_gnutls_hash_alg_map)) { in qcrypto_get_x509_cert_fingerprint()
56 hlen = gnutls_hash_get_len(qcrypto_to_gnutls_hash_alg_map[alg]); in qcrypto_get_x509_cert_fingerprint()
65 qcrypto_to_gnutls_hash_alg_map[alg], in qcrypto_get_x509_cert_fingerprint()
H A Dhmac.c86 QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgo alg, in qcrypto_hmac_new() argument
95 ctx = qcrypto_afalg_hmac_ctx_new(alg, key, nkey, NULL); in qcrypto_hmac_new()
102 ctx = qcrypto_hmac_ctx_new(alg, key, nkey, errp); in qcrypto_hmac_new()
111 hmac->alg = alg; in qcrypto_hmac_new()
H A Dcipher-afalg.c21 qcrypto_afalg_cipher_format_name(QCryptoCipherAlgo alg, in qcrypto_afalg_cipher_format_name() argument
29 switch (alg) { in qcrypto_afalg_cipher_format_name()
50 error_setg(errp, "Unsupported cipher algorithm %d", alg); in qcrypto_afalg_cipher_format_name()
63 qcrypto_afalg_cipher_ctx_new(QCryptoCipherAlgo alg, in qcrypto_afalg_cipher_ctx_new() argument
72 name = qcrypto_afalg_cipher_format_name(alg, mode, errp); in qcrypto_afalg_cipher_ctx_new()
96 expect_niv = qcrypto_cipher_get_iv_len(alg, mode); in qcrypto_afalg_cipher_ctx_new()
126 expect_niv = qcrypto_cipher_get_iv_len(cipher->alg, cipher->mode); in qcrypto_afalg_cipher_setiv()
H A Divgen.c30 QCryptoIVGen *qcrypto_ivgen_new(QCryptoIVGenAlgo alg, in qcrypto_ivgen_new() argument
38 ivgen->algorithm = alg; in qcrypto_ivgen_new()
42 switch (alg) { in qcrypto_ivgen_new()
53 error_setg(errp, "Unknown block IV generator algorithm %d", alg); in qcrypto_ivgen_new()
/qemu/tests/unit/
H A Dtest-crypto-cipher.c30 QCryptoCipherAlgo alg; member
46 .alg = QCRYPTO_CIPHER_ALGO_AES_128,
63 .alg = QCRYPTO_CIPHER_ALGO_AES_192,
159 .alg = QCRYPTO_CIPHER_ALGO_DES,
168 .alg = QCRYPTO_CIPHER_ALGO_DES,
177 .alg = QCRYPTO_CIPHER_ALGO_DES,
194 .alg = QCRYPTO_CIPHER_ALGO_3DES,
223 .alg = QCRYPTO_CIPHER_ALGO_3DES,
236 .alg = QCRYPTO_CIPHER_ALGO_3DES,
389 .alg = QCRYPTO_CIPHER_ALGO_SM4,
[all …]
H A Dtest-crypto-hmac.c30 QCryptoHashAlgo alg; member
36 .alg = QCRYPTO_HASH_ALGO_MD5,
41 .alg = QCRYPTO_HASH_ALGO_SHA1,
47 .alg = QCRYPTO_HASH_ALGO_SHA224,
53 .alg = QCRYPTO_HASH_ALGO_SHA256,
59 .alg = QCRYPTO_HASH_ALGO_SHA384,
66 .alg = QCRYPTO_HASH_ALGO_SHA512,
74 .alg = QCRYPTO_HASH_ALGO_RIPEMD160,
81 .alg = QCRYPTO_HASH_ALGO_SM3,
104 if (!qcrypto_hmac_supports(data->alg)) { in test_hmac_alloc()
[all …]
/qemu/include/crypto/
H A Dhash.h40 QCryptoHashAlgo alg; member
54 gboolean qcrypto_hash_supports(QCryptoHashAlgo alg);
65 size_t qcrypto_hash_digest_len(QCryptoHashAlgo alg);
92 int qcrypto_hash_bytesv(QCryptoHashAlgo alg,
124 int qcrypto_hash_bytes(QCryptoHashAlgo alg,
148 int qcrypto_hash_digestv(QCryptoHashAlgo alg,
262 QCryptoHash *qcrypto_hash_new(QCryptoHashAlgo alg, Error **errp);
291 int qcrypto_hash_digest(QCryptoHashAlgo alg,
314 int qcrypto_hash_base64v(QCryptoHashAlgo alg,
337 int qcrypto_hash_base64(QCryptoHashAlgo alg,
H A Dcipher.h81 QCryptoCipherAlgo alg; member
96 bool qcrypto_cipher_supports(QCryptoCipherAlgo alg,
109 size_t qcrypto_cipher_get_block_len(QCryptoCipherAlgo alg);
120 size_t qcrypto_cipher_get_key_len(QCryptoCipherAlgo alg);
133 size_t qcrypto_cipher_get_iv_len(QCryptoCipherAlgo alg,
159 QCryptoCipher *qcrypto_cipher_new(QCryptoCipherAlgo alg,
/qemu/tests/bench/
H A Dbenchmark-crypto-cipher.c20 QCryptoCipherAlgo alg) in test_cipher_speed() argument
31 if (!qcrypto_cipher_supports(alg, mode)) { in test_cipher_speed()
35 nkey = qcrypto_cipher_get_key_len(alg); in test_cipher_speed()
36 niv = qcrypto_cipher_get_iv_len(alg, mode); in test_cipher_speed()
52 cipher = qcrypto_cipher_new(alg, mode, in test_cipher_speed()
74 QCryptoCipherAlgo_str(alg), in test_cipher_speed()
91 QCryptoCipherAlgo_str(alg), in test_cipher_speed()
170 char *alg = NULL; in main() local
176 if ((!alg || g_str_equal(alg, #mode)) && \ in main()
184 alg = argv[1]; in main()
H A Dbenchmark-crypto-akcipher.c28 opt.alg = QCRYPTO_AK_CIPHER_ALGO_RSA; in create_rsa_akcipher()
110 char *alg = NULL; in main() local
116 if ((!alg || g_str_equal(alg, #asym_alg)) && \ in main()
124 alg = argv[1]; in main()
/qemu/tests/qemu-iotests/
H A D210.out20 ivgen alg: plain64
22 hash alg: sha256
23 cipher alg: aes-256
73 ivgen alg: plain64
75 hash alg: sha1
76 cipher alg: aes-128
129 ivgen alg: plain64
131 hash alg: sha256
132 cipher alg: aes-256
200 ivgen alg: plain64
[all …]
H A D198.out41 ivgen alg: plain64
43 hash alg: sha256
44 cipher alg: aes-256
87 ivgen alg: plain64
89 hash alg: sha256
90 cipher alg: aes-256
H A D082.out61 encrypt.hash-alg=<str> - Name of encryption hash algorithm
63 encrypt.ivgen-alg=<str> - Name of IV generator algorithm
87 encrypt.hash-alg=<str> - Name of encryption hash algorithm
89 encrypt.ivgen-alg=<str> - Name of IV generator algorithm
113 encrypt.hash-alg=<str> - Name of encryption hash algorithm
115 encrypt.ivgen-alg=<str> - Name of IV generator algorithm
141 encrypt.ivgen-alg=<str> - Name of IV generator algorithm
167 encrypt.ivgen-alg=<str> - Name of IV generator algorithm
193 encrypt.ivgen-alg=<str> - Name of IV generator algorithm
219 encrypt.ivgen-alg=<str> - Name of IV generator algorithm
[all …]
/qemu/qapi/
H A Dcrypto.json229 '*ivgen-alg': 'QCryptoIVGenAlgo',
231 '*hash-alg': 'QCryptoHashAlgo',
309 # @hash-alg: the master key hash algorithm
326 'ivgen-alg': 'QCryptoIVGenAlgo',
328 'hash-alg': 'QCryptoHashAlgo',
591 # @hash-alg: QCryptoHashAlgo
593 # @padding-alg: QCryptoRSAPaddingAlgo
598 'data': { 'hash-alg':'QCryptoHashAlgo',
607 # @alg: encryption cipher algorithm
612 'base': { 'alg': 'QCryptoAkCipherAlgo' },
[all …]

123