summaryrefslogtreecommitdiff
path: root/deps/openssl/openssl/crypto/evp/m_sha1.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/openssl/openssl/crypto/evp/m_sha1.c')
-rw-r--r--deps/openssl/openssl/crypto/evp/m_sha1.c59
1 files changed, 54 insertions, 5 deletions
diff --git a/deps/openssl/openssl/crypto/evp/m_sha1.c b/deps/openssl/openssl/crypto/evp/m_sha1.c
index e68f32a044..ac52417855 100644
--- a/deps/openssl/openssl/crypto/evp/m_sha1.c
+++ b/deps/openssl/openssl/crypto/evp/m_sha1.c
@@ -15,6 +15,7 @@
#include <openssl/sha.h>
#include <openssl/rsa.h>
#include "internal/evp_int.h"
+#include "internal/sha.h"
static int init(EVP_MD_CTX *ctx)
{
@@ -107,7 +108,7 @@ static const EVP_MD sha1_md = {
const EVP_MD *EVP_sha1(void)
{
- return (&sha1_md);
+ return &sha1_md;
}
static int init224(EVP_MD_CTX *ctx)
@@ -156,7 +157,7 @@ static const EVP_MD sha224_md = {
const EVP_MD *EVP_sha224(void)
{
- return (&sha224_md);
+ return &sha224_md;
}
static const EVP_MD sha256_md = {
@@ -175,7 +176,17 @@ static const EVP_MD sha256_md = {
const EVP_MD *EVP_sha256(void)
{
- return (&sha256_md);
+ return &sha256_md;
+}
+
+static int init512_224(EVP_MD_CTX *ctx)
+{
+ return sha512_224_init(EVP_MD_CTX_md_data(ctx));
+}
+
+static int init512_256(EVP_MD_CTX *ctx)
+{
+ return sha512_256_init(EVP_MD_CTX_md_data(ctx));
}
static int init384(EVP_MD_CTX *ctx)
@@ -209,6 +220,44 @@ static int final512(EVP_MD_CTX *ctx, unsigned char *md)
return SHA512_Final(md, EVP_MD_CTX_md_data(ctx));
}
+static const EVP_MD sha512_224_md = {
+ NID_sha512_224,
+ NID_sha512_224WithRSAEncryption,
+ SHA224_DIGEST_LENGTH,
+ EVP_MD_FLAG_DIGALGID_ABSENT,
+ init512_224,
+ update512,
+ final512,
+ NULL,
+ NULL,
+ SHA512_CBLOCK,
+ sizeof(EVP_MD *) + sizeof(SHA512_CTX),
+};
+
+const EVP_MD *EVP_sha512_224(void)
+{
+ return &sha512_224_md;
+}
+
+static const EVP_MD sha512_256_md = {
+ NID_sha512_256,
+ NID_sha512_256WithRSAEncryption,
+ SHA256_DIGEST_LENGTH,
+ EVP_MD_FLAG_DIGALGID_ABSENT,
+ init512_256,
+ update512,
+ final512,
+ NULL,
+ NULL,
+ SHA512_CBLOCK,
+ sizeof(EVP_MD *) + sizeof(SHA512_CTX),
+};
+
+const EVP_MD *EVP_sha512_256(void)
+{
+ return &sha512_256_md;
+}
+
static const EVP_MD sha384_md = {
NID_sha384,
NID_sha384WithRSAEncryption,
@@ -225,7 +274,7 @@ static const EVP_MD sha384_md = {
const EVP_MD *EVP_sha384(void)
{
- return (&sha384_md);
+ return &sha384_md;
}
static const EVP_MD sha512_md = {
@@ -244,5 +293,5 @@ static const EVP_MD sha512_md = {
const EVP_MD *EVP_sha512(void)
{
- return (&sha512_md);
+ return &sha512_md;
}