diff options
author | Richard Levitte <levitte@openssl.org> | 2015-11-27 14:17:50 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-12-07 17:36:57 +0100 |
commit | 77a01145be26ceeefa6870e1e9dd7f99ac123fa3 (patch) | |
tree | 5b2426456e3a7f4b8fd4790462ebf7068b547622 /crypto/evp/p_sign.c | |
parent | 7638370ca6cb1d89eba5d891f522776b9da3d6e7 (diff) |
Have other crypto/evp files include evp_locl.h
Note: this does not include the files in crypto/evp that are just
instanciations of EVP_MD.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/evp/p_sign.c')
-rw-r--r-- | crypto/evp/p_sign.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/crypto/evp/p_sign.c b/crypto/evp/p_sign.c index 808d0de013..da17514df0 100644 --- a/crypto/evp/p_sign.c +++ b/crypto/evp/p_sign.c @@ -72,17 +72,20 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, EVP_PKEY_CTX *pkctx = NULL; *siglen = 0; - if (ctx->flags & EVP_MD_CTX_FLAG_FINALISE) { + if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_FINALISE)) { if (!EVP_DigestFinal_ex(ctx, m, &m_len)) goto err; } else { int rv = 0; - EVP_MD_CTX tmp_ctx; - EVP_MD_CTX_init(&tmp_ctx); - rv = EVP_MD_CTX_copy_ex(&tmp_ctx, ctx); + EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_create(); + if (tmp_ctx == NULL) { + EVPerr(EVP_F_EVP_SIGNFINAL, ERR_R_MALLOC_FAILURE); + return 0; + } + rv = EVP_MD_CTX_copy_ex(tmp_ctx, ctx); if (rv) - rv = EVP_DigestFinal_ex(&tmp_ctx, m, &m_len); - EVP_MD_CTX_cleanup(&tmp_ctx); + rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len); + EVP_MD_CTX_destroy(tmp_ctx); if (!rv) return 0; } @@ -101,6 +104,6 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, *siglen = sltmp; i = 1; err: - EVP_PKEY_CTX_free(pkctx); - return i; + EVP_PKEY_CTX_free(pkctx); + return i; } |