| /openbmc/qemu/crypto/ |
| H A D | cipher.c | 72 size_t qcrypto_cipher_get_block_len(QCryptoCipherAlgo alg) in qcrypto_cipher_get_block_len() argument 74 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() 79 size_t qcrypto_cipher_get_key_len(QCryptoCipherAlgo alg) in qcrypto_cipher_get_key_len() argument 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() 86 size_t qcrypto_cipher_get_iv_len(QCryptoCipherAlgo alg, in qcrypto_cipher_get_iv_len() argument 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() 104 qcrypto_cipher_validate_key_length(QCryptoCipherAlgo alg, in qcrypto_cipher_validate_key_length() argument [all …]
|
| H A D | hash-afalg.c | 24 qcrypto_afalg_hash_format_name(QCryptoHashAlgo alg, in qcrypto_afalg_hash_format_name() argument 31 switch (alg) { in qcrypto_afalg_hash_format_name() 55 error_setg(errp, "Unsupported hash algorithm %d", alg); in qcrypto_afalg_hash_format_name() 69 qcrypto_afalg_hash_hmac_ctx_new(QCryptoHashAlgo alg, in qcrypto_afalg_hash_hmac_ctx_new() argument 76 name = qcrypto_afalg_hash_format_name(alg, is_hmac, errp); in qcrypto_afalg_hash_hmac_ctx_new() 103 qcrypto_afalg_hash_ctx_new(QCryptoHashAlgo alg, in qcrypto_afalg_hash_ctx_new() argument 106 return qcrypto_afalg_hash_hmac_ctx_new(alg, NULL, 0, false, errp); in qcrypto_afalg_hash_ctx_new() 110 qcrypto_afalg_hmac_ctx_new(QCryptoHashAlgo alg, in qcrypto_afalg_hmac_ctx_new() argument 114 return qcrypto_afalg_hash_hmac_ctx_new(alg, key, nkey, true, errp); in qcrypto_afalg_hmac_ctx_new() 118 QCryptoHash *qcrypto_afalg_hash_new(QCryptoHashAlgo alg, Error **errp) in qcrypto_afalg_hash_new() argument [all …]
|
| H A D | hash.c | 41 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 54 g_autoptr(QCryptoHash) ctx = qcrypto_hash_new(alg, errp); in qcrypto_hash_bytesv() 69 int qcrypto_hash_bytes(QCryptoHashAlgo alg, in qcrypto_hash_bytes() argument 78 return qcrypto_hash_bytesv(alg, &iov, 1, result, resultlen, errp); in qcrypto_hash_bytes() 101 QCryptoHash *qcrypto_hash_new(QCryptoHashAlgo alg, Error **errp) in qcrypto_hash_new() argument 105 if (!qcrypto_hash_supports(alg)) { in qcrypto_hash_new() 107 QCryptoHashAlgo_str(alg)); in qcrypto_hash_new() [all …]
|
| H A D | hmac-gnutls.c | 38 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 D | hash-gcrypt.c | 42 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 D | hash-glib.c | 38 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 D | hash-gnutls.c | 39 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 D | hmac-glib.c | 35 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 D | hmac-nettle.c | 105 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 D | hmac-gcrypt.c | 39 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 D | hash-nettle.c | 112 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 D | cipher-stub.c.inc | 10 bool qcrypto_cipher_supports(QCryptoCipherAlgo alg, 16 static QCryptoCipher *qcrypto_cipher_ctx_new(QCryptoCipherAlgo alg, 22 if (!qcrypto_cipher_validate_key_length(alg, mode, nkey, errp)) { 28 QCryptoCipherAlgo_str(alg));
|
| H A D | x509-utils.c | 29 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() 60 hlen = gnutls_hash_get_len(qcrypto_to_gnutls_hash_alg_map[alg]); in qcrypto_get_x509_cert_fingerprint() 69 qcrypto_to_gnutls_hash_alg_map[alg], in qcrypto_get_x509_cert_fingerprint()
|
| H A D | ivgen.c | 30 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()
|
| H A D | hmac.c | 86 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 D | cipher-afalg.c | 21 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()
|
| /openbmc/qemu/tests/unit/ |
| H A D | test-crypto-cipher.c | 30 QCryptoCipherAlgo alg; member 46 .alg = QCRYPTO_CIPHER_ALGO_AES_128, 63 .alg = QCRYPTO_CIPHER_ALGO_AES_192, 80 .alg = QCRYPTO_CIPHER_ALGO_AES_256, 99 .alg = QCRYPTO_CIPHER_ALGO_AES_128, 117 .alg = QCRYPTO_CIPHER_ALGO_AES_192, 135 .alg = QCRYPTO_CIPHER_ALGO_AES_256, 159 .alg = QCRYPTO_CIPHER_ALGO_DES, 168 .alg = QCRYPTO_CIPHER_ALGO_DES, 177 .alg = QCRYPTO_CIPHER_ALGO_DES, [all …]
|
| H A D | test-crypto-hmac.c | 30 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 …]
|
| /openbmc/qemu/include/crypto/ |
| H A D | hash.h | 40 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 D | cipher.h | 81 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,
|
| H A D | hmac.h | 19 QCryptoHashAlgo alg; member 34 bool qcrypto_hmac_supports(QCryptoHashAlgo alg); 55 QCryptoHmac *qcrypto_hmac_new(QCryptoHashAlgo alg,
|
| /openbmc/qemu/tests/bench/ |
| H A D | benchmark-crypto-cipher.c | 20 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 D | benchmark-crypto-akcipher.c | 28 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()
|
| /openbmc/qemu/tests/qemu-iotests/ |
| H A D | 210.out | 20 ivgen alg: plain64 22 hash alg: sha256 23 cipher alg: aes-256 63 …alg": "aes-128", "cipher-mode": "cbc", "driver": "luks", "file": {"driver": "file", "filename": "T… 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 [all …]
|
| /openbmc/qemu/qapi/ |
| H A D | crypto.json | 208 # @cipher-alg: the cipher algorithm for data encryption. Currently 214 # @ivgen-alg: the initialization vector generator. Currently defaults 217 # @ivgen-hash-alg: the initialization vector generator hash. 220 # @hash-alg: the master key hash algorithm. Currently defaults to 230 'data': { '*cipher-alg': 'QCryptoCipherAlgo', 232 '*ivgen-alg': 'QCryptoIVGenAlgo', 233 '*ivgen-hash-alg': 'QCryptoHashAlgo', 234 '*hash-alg': 'QCryptoHashAlgo', 304 # @cipher-alg: the cipher algorithm for data encryption 308 # @ivgen-alg: the initialization vector generator [all …]
|