summaryrefslogtreecommitdiffstats
path: root/crypto/evp/m_sha1.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2019-04-11 20:27:59 +1000
committerShane Lontis <shane.lontis@oracle.com>2019-06-04 12:09:50 +1000
commitd5e5e2ffafc7dbc861f7d285508cf129c5e8f5ac (patch)
tree3920b0febd6d2716940fb022b57894fe2ebf565d /crypto/evp/m_sha1.c
parentbf5b04ea25d6ac7d31e388b4e87d3eb5cd1e1e2b (diff)
Move digests to providers
Move digest code into the relevant providers (fips, default, legacy). The headers are temporarily moved to be internal, and will be moved into providers after all external references are resolved. The deprecated digest code can not be removed until EVP_PKEY (signing) is supported by providers. EVP_MD data can also not yet be cleaned up for the same reasons. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8763)
Diffstat (limited to 'crypto/evp/m_sha1.c')
-rw-r--r--crypto/evp/m_sha1.c58
1 files changed, 2 insertions, 56 deletions
diff --git a/crypto/evp/m_sha1.c b/crypto/evp/m_sha1.c
index 59333b24d0..1258ea03bc 100644
--- a/crypto/evp/m_sha1.c
+++ b/crypto/evp/m_sha1.c
@@ -32,63 +32,9 @@ static int final(EVP_MD_CTX *ctx, unsigned char *md)
return SHA1_Final(md, EVP_MD_CTX_md_data(ctx));
}
-static int ctrl(EVP_MD_CTX *ctx, int cmd, int mslen, void *ms)
+static int ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2)
{
- unsigned char padtmp[40];
- unsigned char sha1tmp[SHA_DIGEST_LENGTH];
-
- 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;
-
- /* At this point hash contains all handshake messages, update
- * with master secret and pad_1.
- */
-
- if (SHA1_Update(sha1, ms, mslen) <= 0)
- return 0;
-
- /* Set padtmp to pad_1 value */
- memset(padtmp, 0x36, sizeof(padtmp));
-
- if (!SHA1_Update(sha1, padtmp, sizeof(padtmp)))
- return 0;
-
- if (!SHA1_Final(sha1tmp, sha1))
- return 0;
-
- /* Reinitialise context */
-
- if (!SHA1_Init(sha1))
- return 0;
-
- if (SHA1_Update(sha1, ms, mslen) <= 0)
- return 0;
-
- /* Set padtmp to pad_2 value */
- memset(padtmp, 0x5c, sizeof(padtmp));
-
- if (!SHA1_Update(sha1, padtmp, sizeof(padtmp)))
- return 0;
-
- if (!SHA1_Update(sha1, sha1tmp, sizeof(sha1tmp)))
- return 0;
-
- /* Now when ctx is finalised it will return the SSL v3 hash value */
- OPENSSL_cleanse(sha1tmp, sizeof(sha1tmp));
-
- return 1;
-
+ return sha1_ctrl(ctx != NULL ? EVP_MD_CTX_md_data(ctx) : NULL, cmd, p1, p2);
}
static const EVP_MD sha1_md = {