summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_saos.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_saos.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_saos.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c
index fb0fae5a43..85adacc08f 100644
--- a/src/lib/libcrypto/rsa/rsa_saos.c
+++ b/src/lib/libcrypto/rsa/rsa_saos.c
@@ -58,18 +58,14 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "bn.h" 61#include <openssl/bn.h>
62#include "rsa.h" 62#include <openssl/rsa.h>
63#include "objects.h" 63#include <openssl/objects.h>
64#include "x509.h" 64#include <openssl/x509.h>
65 65
66int RSA_sign_ASN1_OCTET_STRING(type,m,m_len,sigret,siglen,rsa) 66int RSA_sign_ASN1_OCTET_STRING(int type,
67int type; 67 const unsigned char *m, unsigned int m_len,
68unsigned char *m; 68 unsigned char *sigret, unsigned int *siglen, RSA *rsa)
69unsigned int m_len;
70unsigned char *sigret;
71unsigned int *siglen;
72RSA *rsa;
73 { 69 {
74 ASN1_OCTET_STRING sig; 70 ASN1_OCTET_STRING sig;
75 int i,j,ret=1; 71 int i,j,ret=1;
@@ -77,7 +73,7 @@ RSA *rsa;
77 73
78 sig.type=V_ASN1_OCTET_STRING; 74 sig.type=V_ASN1_OCTET_STRING;
79 sig.length=m_len; 75 sig.length=m_len;
80 sig.data=m; 76 sig.data=(unsigned char *)m;
81 77
82 i=i2d_ASN1_OCTET_STRING(&sig,NULL); 78 i=i2d_ASN1_OCTET_STRING(&sig,NULL);
83 j=RSA_size(rsa); 79 j=RSA_size(rsa);
@@ -86,7 +82,7 @@ RSA *rsa;
86 RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); 82 RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
87 return(0); 83 return(0);
88 } 84 }
89 s=(unsigned char *)Malloc((unsigned int)j+1); 85 s=(unsigned char *)OPENSSL_malloc((unsigned int)j+1);
90 if (s == NULL) 86 if (s == NULL)
91 { 87 {
92 RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); 88 RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
@@ -101,17 +97,14 @@ RSA *rsa;
101 *siglen=i; 97 *siglen=i;
102 98
103 memset(s,0,(unsigned int)j+1); 99 memset(s,0,(unsigned int)j+1);
104 Free(s); 100 OPENSSL_free(s);
105 return(ret); 101 return(ret);
106 } 102 }
107 103
108int RSA_verify_ASN1_OCTET_STRING(dtype, m, m_len, sigbuf, siglen, rsa) 104int RSA_verify_ASN1_OCTET_STRING(int dtype,
109int dtype; 105 const unsigned char *m,
110unsigned char *m; 106 unsigned int m_len, unsigned char *sigbuf, unsigned int siglen,
111unsigned int m_len; 107 RSA *rsa)
112unsigned char *sigbuf;
113unsigned int siglen;
114RSA *rsa;
115 { 108 {
116 int i,ret=0; 109 int i,ret=0;
117 unsigned char *p,*s; 110 unsigned char *p,*s;
@@ -123,7 +116,7 @@ RSA *rsa;
123 return(0); 116 return(0);
124 } 117 }
125 118
126 s=(unsigned char *)Malloc((unsigned int)siglen); 119 s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
127 if (s == NULL) 120 if (s == NULL)
128 { 121 {
129 RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE); 122 RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
@@ -145,9 +138,9 @@ RSA *rsa;
145 else 138 else
146 ret=1; 139 ret=1;
147err: 140err:
148 if (sig != NULL) ASN1_OCTET_STRING_free(sig); 141 if (sig != NULL) M_ASN1_OCTET_STRING_free(sig);
149 memset(s,0,(unsigned int)siglen); 142 memset(s,0,(unsigned int)siglen);
150 Free(s); 143 OPENSSL_free(s);
151 return(ret); 144 return(ret);
152 } 145 }
153 146