Gitweb:
https://git.exim.org/exim.git/commitdiff/e690dc6c0215bc280336030da2b3bbc9bae75683
Commit: e690dc6c0215bc280336030da2b3bbc9bae75683
Parent: 4a93d57ba2ba7263b6eddee347f9bee9bde97378
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Wed Dec 12 23:14:11 2018 +0000
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Thu Dec 13 17:40:06 2018 +0000
DKIM: more info on verify errors under OpenSSL
---
src/src/pdkim/signing.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/src/pdkim/signing.c b/src/src/pdkim/signing.c
index 7b8a6a0..d749156 100644
--- a/src/src/pdkim/signing.c
+++ b/src/src/pdkim/signing.c
@@ -831,6 +831,7 @@ const uschar *
exim_dkim_verify(ev_ctx * verify_ctx, hashmethod hash, blob * data, blob * sig)
{
const EVP_MD * md;
+const uschar * where;
switch (hash)
{
@@ -859,18 +860,23 @@ else
{
EVP_PKEY_CTX * ctx;
- if ( (ctx = EVP_PKEY_CTX_new(verify_ctx->key, NULL))
- && EVP_PKEY_verify_init(ctx) > 0
- && EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) > 0
- && EVP_PKEY_CTX_set_signature_md(ctx, md) > 0
- && EVP_PKEY_verify(ctx, sig->data, sig->len,
- data->data, data->len) == 1
+ if ( (where = US"EVP_PKEY_CTX_new",
+ (ctx = EVP_PKEY_CTX_new(verify_ctx->key, NULL)))
+ && (where = US"EVP_PKEY_verify_init",
+ EVP_PKEY_verify_init(ctx) > 0)
+ && (where = US"EVP_PKEY_CTX_set_rsa_padding",
+ EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) > 0)
+ && (where = US"EVP_PKEY_CTX_set_signature_md",
+ EVP_PKEY_CTX_set_signature_md(ctx, md) > 0)
+ && (where = US"EVP_PKEY_verify",
+ EVP_PKEY_verify(ctx, sig->data, sig->len,
+ data->data, data->len) == 1)
)
{ EVP_PKEY_CTX_free(ctx); return NULL; }
if (ctx) EVP_PKEY_CTX_free(ctx);
}
-return US ERR_error_string(ERR_get_error(), NULL);
+return string_sprintf("%s: %s", where, ERR_error_string(ERR_get_error(), NULL));
}