Lines Matching full:hash
2 * QEMU Crypto hash algorithms
24 #include "crypto/hash.h"
51 QCryptoHash *hash; in qcrypto_glib_hash_new() local
53 hash = g_new(QCryptoHash, 1); in qcrypto_glib_hash_new()
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()
57 return hash; in qcrypto_glib_hash_new()
61 void qcrypto_glib_hash_free(QCryptoHash *hash) in qcrypto_glib_hash_free() argument
63 if (hash->opaque) { in qcrypto_glib_hash_free()
64 g_checksum_free(hash->opaque); in qcrypto_glib_hash_free()
67 g_free(hash); in qcrypto_glib_hash_free()
72 int qcrypto_glib_hash_update(QCryptoHash *hash, in qcrypto_glib_hash_update() argument
77 GChecksum *ctx = hash->opaque; in qcrypto_glib_hash_update()
87 int qcrypto_glib_hash_finalize(QCryptoHash *hash, in qcrypto_glib_hash_finalize() argument
93 GChecksum *ctx = hash->opaque; in qcrypto_glib_hash_finalize()
95 ret = g_checksum_type_get_length(qcrypto_hash_alg_map[hash->alg]); in qcrypto_glib_hash_finalize()
97 error_setg(errp, "Unable to get hash length"); in qcrypto_glib_hash_finalize()
107 "Result buffer size %zu is smaller than hash %d", in qcrypto_glib_hash_finalize()