summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/pem/pem_sign.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/pem/pem_sign.c')
-rw-r--r--src/lib/libcrypto/pem/pem_sign.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/lib/libcrypto/pem/pem_sign.c b/src/lib/libcrypto/pem/pem_sign.c
index d56f9f9e14..c3b9808cb2 100644
--- a/src/lib/libcrypto/pem/pem_sign.c
+++ b/src/lib/libcrypto/pem/pem_sign.c
@@ -58,38 +58,31 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "rand.h" 61#include <openssl/rand.h>
62#include "evp.h" 62#include <openssl/evp.h>
63#include "objects.h" 63#include <openssl/objects.h>
64#include "x509.h" 64#include <openssl/x509.h>
65#include "pem.h" 65#include <openssl/pem.h>
66 66
67void PEM_SignInit(ctx,type) 67void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type)
68EVP_MD_CTX *ctx;
69EVP_MD *type;
70 { 68 {
71 EVP_DigestInit(ctx,type); 69 EVP_DigestInit_ex(ctx, type, NULL);
72 } 70 }
73 71
74void PEM_SignUpdate(ctx,data,count) 72void PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *data,
75EVP_MD_CTX *ctx; 73 unsigned int count)
76unsigned char *data;
77unsigned int count;
78 { 74 {
79 EVP_DigestUpdate(ctx,data,count); 75 EVP_DigestUpdate(ctx,data,count);
80 } 76 }
81 77
82int PEM_SignFinal(ctx,sigret,siglen,pkey) 78int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
83EVP_MD_CTX *ctx; 79 EVP_PKEY *pkey)
84unsigned char *sigret;
85unsigned int *siglen;
86EVP_PKEY *pkey;
87 { 80 {
88 unsigned char *m; 81 unsigned char *m;
89 int i,ret=0; 82 int i,ret=0;
90 unsigned int m_len; 83 unsigned int m_len;
91 84
92 m=(unsigned char *)Malloc(EVP_PKEY_size(pkey)+2); 85 m=(unsigned char *)OPENSSL_malloc(EVP_PKEY_size(pkey)+2);
93 if (m == NULL) 86 if (m == NULL)
94 { 87 {
95 PEMerr(PEM_F_PEM_SIGNFINAL,ERR_R_MALLOC_FAILURE); 88 PEMerr(PEM_F_PEM_SIGNFINAL,ERR_R_MALLOC_FAILURE);
@@ -103,7 +96,7 @@ EVP_PKEY *pkey;
103 ret=1; 96 ret=1;
104err: 97err:
105 /* ctx has been zeroed by EVP_SignFinal() */ 98 /* ctx has been zeroed by EVP_SignFinal() */
106 if (m != NULL) Free(m); 99 if (m != NULL) OPENSSL_free(m);
107 return(ret); 100 return(ret);
108 } 101 }
109 102