Add new function, EVP_MD_CTX_copy() to replace frequent use of memcpy.
[openssl.git] / crypto / evp / p_sign.c
index ad5bcd8ba861186daf26e24f1f5f00ee2377d818..4b3420608360331b914fc1c0c25db3eb08ce9813 100644 (file)
@@ -1,5 +1,5 @@
 /* crypto/evp/p_sign.c */
 /* crypto/evp/p_sign.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
  * This package is an SSL implementation written
  * All rights reserved.
  *
  * This package is an SSL implementation written
@@ -88,9 +88,11 @@ EVP_PKEY *pkey;
        unsigned char m[EVP_MAX_MD_SIZE];
        unsigned int m_len;
        int i,ok=0,v;
        unsigned char m[EVP_MAX_MD_SIZE];
        unsigned int m_len;
        int i,ok=0,v;
+       MS_STATIC EVP_MD_CTX tmp_ctx;
 
        *siglen=0;
 
        *siglen=0;
-       EVP_DigestFinal(ctx,&(m[0]),&m_len);
+       EVP_MD_CTX_copy(&tmp_ctx,ctx);   
+       EVP_DigestFinal(&tmp_ctx,&(m[0]),&m_len);
        for (i=0; i<4; i++)
                {
                v=ctx->digest->required_pkey_type[i];
        for (i=0; i<4; i++)
                {
                v=ctx->digest->required_pkey_type[i];