Lines Matching full:hash
2 * QEMU Crypto hash algorithms
25 #include "crypto/hash.h"
54 QCryptoHash *hash; in qcrypto_gcrypt_hash_new() local
57 hash = g_new(QCryptoHash, 1); in qcrypto_gcrypt_hash_new()
58 hash->alg = alg; in qcrypto_gcrypt_hash_new()
59 hash->opaque = g_new(gcry_md_hd_t, 1); in qcrypto_gcrypt_hash_new()
61 ret = gcry_md_open((gcry_md_hd_t *) hash->opaque, in qcrypto_gcrypt_hash_new()
65 "Unable to initialize hash algorithm: %s", in qcrypto_gcrypt_hash_new()
67 g_free(hash->opaque); in qcrypto_gcrypt_hash_new()
68 g_free(hash); in qcrypto_gcrypt_hash_new()
71 return hash; in qcrypto_gcrypt_hash_new()
75 void qcrypto_gcrypt_hash_free(QCryptoHash *hash) in qcrypto_gcrypt_hash_free() argument
77 gcry_md_hd_t *ctx = hash->opaque; in qcrypto_gcrypt_hash_free()
84 g_free(hash); in qcrypto_gcrypt_hash_free()
89 int qcrypto_gcrypt_hash_update(QCryptoHash *hash, in qcrypto_gcrypt_hash_update() argument
94 gcry_md_hd_t *ctx = hash->opaque; in qcrypto_gcrypt_hash_update()
104 int qcrypto_gcrypt_hash_finalize(QCryptoHash *hash, in qcrypto_gcrypt_hash_finalize() argument
111 gcry_md_hd_t *ctx = hash->opaque; in qcrypto_gcrypt_hash_finalize()
113 ret = gcry_md_get_algo_dlen(qcrypto_hash_alg_map[hash->alg]); in qcrypto_gcrypt_hash_finalize()
115 error_setg(errp, "Unable to get hash length"); in qcrypto_gcrypt_hash_finalize()
124 "Result buffer size %zu is smaller than hash %d", in qcrypto_gcrypt_hash_finalize()