/* 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
#include <stdio.h>
#include "cryptlib.h"
-#include "evp.h"
-#include "objects.h"
-#include "x509.h"
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/x509.h>
#ifdef undef
-void EVP_SignInit(ctx,type)
-EVP_MD_CTX *ctx;
-EVP_MD *type;
+void EVP_SignInit(EVP_MD_CTX *ctx, EVP_MD *type)
{
- EVP_DigestInit(ctx,type);
+ EVP_DigestInit_ex(ctx,type);
}
-void EVP_SignUpdate(ctx,data,count)
-EVP_MD_CTX *ctx;
-unsigned char *data;
-unsigned int count;
+void EVP_SignUpdate(EVP_MD_CTX *ctx, unsigned char *data,
+ unsigned int count)
{
EVP_DigestUpdate(ctx,data,count);
}
#endif
-int EVP_SignFinal(ctx,sigret,siglen,pkey)
-EVP_MD_CTX *ctx;
-unsigned char *sigret;
-unsigned int *siglen;
-EVP_PKEY *pkey;
+int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
+ EVP_PKEY *pkey)
{
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;
- EVP_DigestFinal(ctx,&(m[0]),&m_len);
+ EVP_MD_CTX_init(&tmp_ctx);
+ EVP_MD_CTX_copy_ex(&tmp_ctx,ctx);
+ EVP_DigestFinal_ex(&tmp_ctx,&(m[0]),&m_len);
+ EVP_MD_CTX_cleanup(&tmp_ctx);
for (i=0; i<4; i++)
{
v=ctx->digest->required_pkey_type[i];