diff options
author | Mark J. Cox <mark@openssl.org> | 1999-01-31 12:14:39 +0000 |
---|---|---|
committer | Mark J. Cox <mark@openssl.org> | 1999-01-31 12:14:39 +0000 |
commit | 351d899878c567448b9b9b6d715ec828c888f3c2 (patch) | |
tree | 4afa6a04d378d8107b454ba1dba0c8b4beb92999 /crypto/evp/digest.c | |
parent | 5810a5f4c767ba68185e38fa2c5709425c1903a8 (diff) |
Add new function, EVP_MD_CTX_copy() to replace frequent use of memcpy.
Submitted by: Eric A Young - from changes to C2Net SSLeay
Reviewed by: Mark Cox
PR:
Diffstat (limited to 'crypto/evp/digest.c')
-rw-r--r-- | crypto/evp/digest.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index d65f0036f7..7ef0e73b5a 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -87,3 +87,13 @@ unsigned int *size; *size=ctx->digest->md_size; memset(&(ctx->md),0,sizeof(ctx->md)); } + +int EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in) +{ + if ((in == NULL) || (in->digest == NULL)) { + EVPerr(EVP_F_EVP_MD_CTX_COPY,EVP_R_INPUT_NOT_INITALISED); + return 0; + } + memcpy((char *)out,(char *)in,in->digest->ctx_size); + return 1; +} |