summaryrefslogtreecommitdiffstats
path: root/sm/certcheck.c
diff options
context:
space:
mode:
Diffstat (limited to 'sm/certcheck.c')
-rw-r--r--sm/certcheck.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sm/certcheck.c b/sm/certcheck.c
index e8b842b88..efb1414cc 100644
--- a/sm/certcheck.c
+++ b/sm/certcheck.c
@@ -68,6 +68,8 @@ do_encode_md (gcry_md_hd_t md, int algo, int pkalgo, unsigned int nbits,
nframe = (nbits+7) / 8;
asnlen = DIM(asn);
+ if (!algo || gcry_md_test_algo (algo))
+ return gpg_error (GPG_ERR_DIGEST_ALGO);
if (gcry_md_algo_info (algo, GCRYCTL_GET_ASNOID, asn, &asnlen))
{
log_error ("no object identifier for algo %d\n", algo);