diff options
Diffstat (limited to 'src/lib/libcrypto/evp/digest.c')
-rw-r--r-- | src/lib/libcrypto/evp/digest.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c index d65f0036f7..c560733568 100644 --- a/src/lib/libcrypto/evp/digest.c +++ b/src/lib/libcrypto/evp/digest.c | |||
@@ -58,32 +58,35 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include "objects.h" | 61 | #include <openssl/objects.h> |
62 | #include "evp.h" | 62 | #include <openssl/evp.h> |
63 | 63 | ||
64 | void EVP_DigestInit(ctx,type) | 64 | void EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) |
65 | EVP_MD_CTX *ctx; | ||
66 | EVP_MD *type; | ||
67 | { | 65 | { |
68 | ctx->digest=type; | 66 | ctx->digest=type; |
69 | type->init(&(ctx->md)); | 67 | type->init(&(ctx->md)); |
70 | } | 68 | } |
71 | 69 | ||
72 | void EVP_DigestUpdate(ctx,data,count) | 70 | void EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, |
73 | EVP_MD_CTX *ctx; | 71 | unsigned int count) |
74 | unsigned char *data; | ||
75 | unsigned int count; | ||
76 | { | 72 | { |
77 | ctx->digest->update(&(ctx->md.base[0]),data,(unsigned long)count); | 73 | ctx->digest->update(&(ctx->md.base[0]),data,(unsigned long)count); |
78 | } | 74 | } |
79 | 75 | ||
80 | void EVP_DigestFinal(ctx,md,size) | 76 | void EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) |
81 | EVP_MD_CTX *ctx; | ||
82 | unsigned char *md; | ||
83 | unsigned int *size; | ||
84 | { | 77 | { |
85 | ctx->digest->final(md,&(ctx->md.base[0])); | 78 | ctx->digest->final(md,&(ctx->md.base[0])); |
86 | if (size != NULL) | 79 | if (size != NULL) |
87 | *size=ctx->digest->md_size; | 80 | *size=ctx->digest->md_size; |
88 | memset(&(ctx->md),0,sizeof(ctx->md)); | 81 | memset(&(ctx->md),0,sizeof(ctx->md)); |
89 | } | 82 | } |
83 | |||
84 | int EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in) | ||
85 | { | ||
86 | if ((in == NULL) || (in->digest == NULL)) { | ||
87 | EVPerr(EVP_F_EVP_MD_CTX_COPY,EVP_R_INPUT_NOT_INITIALIZED); | ||
88 | return 0; | ||
89 | } | ||
90 | memcpy((char *)out,(char *)in,in->digest->ctx_size); | ||
91 | return 1; | ||
92 | } | ||