Lines Matching full:hash

2  * QEMU Crypto hash algorithms
25 #include "crypto/hash.h"
59 QCryptoHash *hash; in qcrypto_gnutls_hash_new() local
62 hash = g_new(QCryptoHash, 1); in qcrypto_gnutls_hash_new()
63 hash->alg = alg; in qcrypto_gnutls_hash_new()
64 hash->opaque = g_new(gnutls_hash_hd_t, 1); in qcrypto_gnutls_hash_new()
66 ret = gnutls_hash_init(hash->opaque, qcrypto_hash_alg_map[alg]); in qcrypto_gnutls_hash_new()
69 "Unable to initialize hash algorithm: %s", in qcrypto_gnutls_hash_new()
71 g_free(hash->opaque); in qcrypto_gnutls_hash_new()
72 g_free(hash); in qcrypto_gnutls_hash_new()
76 return hash; in qcrypto_gnutls_hash_new()
80 void qcrypto_gnutls_hash_free(QCryptoHash *hash) in qcrypto_gnutls_hash_free() argument
82 gnutls_hash_hd_t *ctx = hash->opaque; in qcrypto_gnutls_hash_free()
86 g_free(hash); in qcrypto_gnutls_hash_free()
91 int qcrypto_gnutls_hash_update(QCryptoHash *hash, in qcrypto_gnutls_hash_update() argument
97 gnutls_hash_hd_t *ctx = hash->opaque; in qcrypto_gnutls_hash_update()
102 error_setg(errp, "Failed to hash data: %s", in qcrypto_gnutls_hash_update()
112 int qcrypto_gnutls_hash_finalize(QCryptoHash *hash, in qcrypto_gnutls_hash_finalize() argument
117 gnutls_hash_hd_t *ctx = hash->opaque; in qcrypto_gnutls_hash_finalize()
120 ret = gnutls_hash_get_len(qcrypto_hash_alg_map[hash->alg]); in qcrypto_gnutls_hash_finalize()
122 error_setg(errp, "Unable to get hash length"); in qcrypto_gnutls_hash_finalize()
131 "Result buffer size %zu is smaller than hash %d", in qcrypto_gnutls_hash_finalize()