summaryrefslogtreecommitdiffstats
path: root/crypto/evp/m_sigver.c
diff options
context:
space:
mode:
authorPaul Yang <yang.yang@baishancloud.com>2018-09-04 11:21:10 +0200
committerPaul Yang <yang.yang@baishancloud.com>2018-09-07 12:12:26 +0200
commit4803717f5e3bcfba3e3442e1611f421bf1090a47 (patch)
treef5745d40a7eeb81e8e49f734ae6f962173981eb7 /crypto/evp/m_sigver.c
parentMake SM2 ID stick to specification (diff)
downloadopenssl-4803717f5e3bcfba3e3442e1611f421bf1090a47.tar.xz
openssl-4803717f5e3bcfba3e3442e1611f421bf1090a47.zip
Support setting SM2 ID
zero-length ID is allowed, but it's not allowed to skip the ID. Fixes: #6534 Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7113)
Diffstat (limited to 'crypto/evp/m_sigver.c')
-rw-r--r--crypto/evp/m_sigver.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/crypto/evp/m_sigver.c b/crypto/evp/m_sigver.c
index 4a0e5d5c55..2eceede28c 100644
--- a/crypto/evp/m_sigver.c
+++ b/crypto/evp/m_sigver.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -75,14 +75,13 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
return 1;
if (!EVP_DigestInit_ex(ctx, type, e))
return 0;
- if (ctx->pctx->pmeth->flags & EVP_PKEY_FLAG_DIGEST_CUSTOM) {
- /*
- * This indicates the current algorithm requires
- * special treatment before hashing the tbs-message.
- */
- if (ctx->pctx->pmeth->digest_custom)
- return ctx->pctx->pmeth->digest_custom(ctx->pctx, ctx);
- }
+ /*
+ * This indicates the current algorithm requires
+ * special treatment before hashing the tbs-message.
+ */
+ if (ctx->pctx->pmeth->digest_custom)
+ return ctx->pctx->pmeth->digest_custom(ctx->pctx, ctx);
+
return 1;
}
@@ -184,9 +183,9 @@ int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig,
else
vctx = 0;
if (ctx->flags & EVP_MD_CTX_FLAG_FINALISE) {
- if (vctx) {
+ if (vctx)
r = ctx->pctx->pmeth->verifyctx(ctx->pctx, sig, siglen, ctx);
- } else
+ else
r = EVP_DigestFinal_ex(ctx, md, &mdlen);
} else {
EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new();
@@ -196,10 +195,10 @@ int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig,
EVP_MD_CTX_free(tmp_ctx);
return -1;
}
- if (vctx) {
+ if (vctx)
r = tmp_ctx->pctx->pmeth->verifyctx(tmp_ctx->pctx,
sig, siglen, tmp_ctx);
- } else
+ else
r = EVP_DigestFinal_ex(tmp_ctx, md, &mdlen);
EVP_MD_CTX_free(tmp_ctx);
}