From 47b2e238e5684eb0a31d363e2c8b949527b59306 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Thu, 17 May 2007 12:35:32 +0000 Subject: [PATCH] Use EVP_DigestVerify() in dgst.c if verifying. --- apps/dgst.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/dgst.c b/apps/dgst.c index 9981ee1db5..147c4f9e61 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -412,13 +412,18 @@ int MAIN(int argc, char **argv) { EVP_MD_CTX *mctx = NULL; EVP_PKEY_CTX *pctx = NULL; + int r; if (!BIO_get_md_ctx(bmd, &mctx)) { BIO_printf(bio_err, "Error getting context\n"); ERR_print_errors(bio_err); goto end; } - if (!EVP_DigestSignInit(mctx, &pctx, md, e, sigkey)) + if (do_verify) + r = EVP_DigestVerifyInit(mctx, &pctx, md, e, sigkey); + else + r = EVP_DigestSignInit(mctx, &pctx, md, e, sigkey); + if (!r) { BIO_printf(bio_err, "Error setting context\n"); ERR_print_errors(bio_err); -- 2.25.1