diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-11-22 21:59:21 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-11-25 20:52:46 +0000 |
commit | cbc8a839959418d8a2c2e3ec6bdf394852c9501e (patch) | |
tree | cab4800e54873e8f98c3a9d655414d83c9c3280f /crypto/evp | |
parent | fb3b70c0bdc676f857e438754345487d5da1c84e (diff) |
Fix ctrl operation for SHA1/MD5SHA1.
This makes S/MIME and CMS signing in MIME format for SHA1 work again.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit a5abd438f85737ffa56320b67c5ef5525fc495c3)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/m_md5_sha1.c | 7 | ||||
-rw-r--r-- | crypto/evp/m_sha1.c | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/crypto/evp/m_md5_sha1.c b/crypto/evp/m_md5_sha1.c index 1213ff64a6..2d98886ba0 100644 --- a/crypto/evp/m_md5_sha1.c +++ b/crypto/evp/m_md5_sha1.c @@ -52,11 +52,16 @@ static int ctrl(EVP_MD_CTX *ctx, int cmd, int mslen, void *ms) unsigned char padtmp[48]; unsigned char md5tmp[MD5_DIGEST_LENGTH]; unsigned char sha1tmp[SHA_DIGEST_LENGTH]; - struct md5_sha1_ctx *mctx = EVP_MD_CTX_md_data(ctx); + struct md5_sha1_ctx *mctx; if (cmd != EVP_CTRL_SSL3_MASTER_SECRET) + return -2; + + if (ctx == NULL) return 0; + mctx = EVP_MD_CTX_md_data(ctx); + /* SSLv3 client auth handling: see RFC-6101 5.6.8 */ if (mslen != 48) return 0; diff --git a/crypto/evp/m_sha1.c b/crypto/evp/m_sha1.c index 4f009560b3..8f30077a4a 100644 --- a/crypto/evp/m_sha1.c +++ b/crypto/evp/m_sha1.c @@ -36,11 +36,16 @@ static int ctrl(EVP_MD_CTX *ctx, int cmd, int mslen, void *ms) unsigned char padtmp[40]; unsigned char sha1tmp[SHA_DIGEST_LENGTH]; - SHA_CTX *sha1 = EVP_MD_CTX_md_data(ctx); + SHA_CTX *sha1; if (cmd != EVP_CTRL_SSL3_MASTER_SECRET) + return -2; + + if (ctx == NULL) return 0; + sha1 = EVP_MD_CTX_md_data(ctx); + /* SSLv3 client auth handling: see RFC-6101 5.6.8 */ if (mslen != 48) return 0; |