Lines Matching full:hash
2 * QEMU Crypto hash algorithms
24 #include "crypto/hash.h"
124 QCryptoHash *hash; in qcrypto_nettle_hash_new() local
126 hash = g_new(QCryptoHash, 1); in qcrypto_nettle_hash_new()
127 hash->alg = alg; in qcrypto_nettle_hash_new()
128 hash->opaque = g_new(union qcrypto_hash_ctx, 1); in qcrypto_nettle_hash_new()
130 qcrypto_hash_alg_map[alg].init(hash->opaque); in qcrypto_nettle_hash_new()
131 return hash; in qcrypto_nettle_hash_new()
135 void qcrypto_nettle_hash_free(QCryptoHash *hash) in qcrypto_nettle_hash_free() argument
137 union qcrypto_hash_ctx *ctx = hash->opaque; in qcrypto_nettle_hash_free()
140 g_free(hash); in qcrypto_nettle_hash_free()
144 int qcrypto_nettle_hash_update(QCryptoHash *hash, in qcrypto_nettle_hash_update() argument
149 union qcrypto_hash_ctx *ctx = hash->opaque; in qcrypto_nettle_hash_update()
152 qcrypto_hash_alg_map[hash->alg].write(ctx, in qcrypto_nettle_hash_update()
161 int qcrypto_nettle_hash_finalize(QCryptoHash *hash, in qcrypto_nettle_hash_finalize() argument
166 union qcrypto_hash_ctx *ctx = hash->opaque; in qcrypto_nettle_hash_finalize()
167 int ret = qcrypto_hash_alg_map[hash->alg].len; in qcrypto_nettle_hash_finalize()
174 "Result buffer size %zu is smaller than hash %d", in qcrypto_nettle_hash_finalize()
179 qcrypto_hash_alg_map[hash->alg].result(ctx, *result_len, *result); in qcrypto_nettle_hash_finalize()