summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/m_sha.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/m_sha.c')
-rw-r--r--src/lib/libcrypto/evp/m_sha.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c
index 6d35b71b85..10697c7ed3 100644
--- a/src/lib/libcrypto/evp/m_sha.c
+++ b/src/lib/libcrypto/evp/m_sha.c
@@ -56,27 +56,39 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_SHA 59#ifndef OPENSSL_NO_SHA
60#include <stdio.h> 60#include <stdio.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include <openssl/evp.h> 62#include <openssl/evp.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64#include <openssl/x509.h> 64#include <openssl/x509.h>
65 65
66static EVP_MD sha_md= 66static int init(EVP_MD_CTX *ctx)
67 { return SHA_Init(ctx->md_data); }
68
69static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
70 { return SHA_Update(ctx->md_data,data,count); }
71
72static int final(EVP_MD_CTX *ctx,unsigned char *md)
73 { return SHA_Final(md,ctx->md_data); }
74
75static const EVP_MD sha_md=
67 { 76 {
68 NID_sha, 77 NID_sha,
69 NID_shaWithRSAEncryption, 78 NID_shaWithRSAEncryption,
70 SHA_DIGEST_LENGTH, 79 SHA_DIGEST_LENGTH,
71 SHA_Init, 80 0,
72 SHA_Update, 81 init,
73 SHA_Final, 82 update,
83 final,
84 NULL,
85 NULL,
74 EVP_PKEY_RSA_method, 86 EVP_PKEY_RSA_method,
75 SHA_CBLOCK, 87 SHA_CBLOCK,
76 sizeof(EVP_MD *)+sizeof(SHA_CTX), 88 sizeof(EVP_MD *)+sizeof(SHA_CTX),
77 }; 89 };
78 90
79EVP_MD *EVP_sha(void) 91const EVP_MD *EVP_sha(void)
80 { 92 {
81 return(&sha_md); 93 return(&sha_md);
82 } 94 }