summaryrefslogtreecommitdiffstats
path: root/crypto/evp/m_sha1.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/evp/m_sha1.c')
-rw-r--r--crypto/evp/m_sha1.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/crypto/evp/m_sha1.c b/crypto/evp/m_sha1.c
index 0fa184b310..d73e412b8d 100644
--- a/crypto/evp/m_sha1.c
+++ b/crypto/evp/m_sha1.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-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
@@ -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)
{
@@ -173,6 +174,16 @@ const EVP_MD *EVP_sha256(void)
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)
{
return SHA384_Init(EVP_MD_CTX_md_data(ctx));
@@ -194,6 +205,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,