summaryrefslogtreecommitdiff
path: root/cipher
diff options
context:
space:
mode:
Diffstat (limited to 'cipher')
-rw-r--r--cipher/md.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/cipher/md.c b/cipher/md.c
index c6bf90d2..948d269b 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -671,6 +671,9 @@ prepare_macpads (gcry_md_hd_t a, const unsigned char *key, size_t keylen)
if (!a->ctx->list)
return GPG_ERR_DIGEST_ALGO; /* Might happen if no algo is enabled. */
+ if (!a->ctx->flags.hmac)
+ return GPG_ERR_DIGEST_ALGO; /* Tried setkey for non-HMAC md. */
+
for (r = a->ctx->list; r; r = r->next)
{
const unsigned char *k;