Call the existing qcrypto_hash_supports method from
qcrypto_hash_bytesv instead of open-coding it again.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
gcry_md_hd_t md;
unsigned char *digest;
- if (alg >= G_N_ELEMENTS(qcrypto_hash_alg_map) ||
- qcrypto_hash_alg_map[alg] == GCRY_MD_NONE) {
+ if (!qcrypto_hash_supports(alg)) {
error_setg(errp,
"Unknown hash algorithm %d",
alg);
int i, ret;
GChecksum *cs;
- if (alg >= G_N_ELEMENTS(qcrypto_hash_alg_map) ||
- qcrypto_hash_alg_map[alg] == -1) {
+ if (!qcrypto_hash_supports(alg)) {
error_setg(errp,
"Unknown hash algorithm %d",
alg);
int i;
union qcrypto_hash_ctx ctx;
- if (alg >= G_N_ELEMENTS(qcrypto_hash_alg_map) ||
- qcrypto_hash_alg_map[alg].init == NULL) {
+ if (!qcrypto_hash_supports(alg)) {
error_setg(errp,
"Unknown hash algorithm %d",
alg);