summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/p_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/p_lib.c')
-rw-r--r--src/lib/libcrypto/evp/p_lib.c53
1 files changed, 17 insertions, 36 deletions
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index 395351b373..3422b77de6 100644
--- a/src/lib/libcrypto/evp/p_lib.c
+++ b/src/lib/libcrypto/evp/p_lib.c
@@ -58,22 +58,13 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "objects.h" 61#include <openssl/objects.h>
62#include "evp.h" 62#include <openssl/evp.h>
63#include "asn1_mac.h" 63#include <openssl/asn1_mac.h>
64#include "x509.h" 64#include <openssl/x509.h>
65 65
66/* EVPerr(EVP_F_D2I_PKEY,EVP_R_UNSUPPORTED_CIPHER); */
67/* EVPerr(EVP_F_D2I_PKEY,EVP_R_IV_TOO_LARGE); */
68
69#ifndef NOPROTO
70static void EVP_PKEY_free_it(EVP_PKEY *x); 66static void EVP_PKEY_free_it(EVP_PKEY *x);
71#else 67int EVP_PKEY_bits(EVP_PKEY *pkey)
72static void EVP_PKEY_free_it();
73#endif
74
75int EVP_PKEY_bits(pkey)
76EVP_PKEY *pkey;
77 { 68 {
78#ifndef NO_RSA 69#ifndef NO_RSA
79 if (pkey->type == EVP_PKEY_RSA) 70 if (pkey->type == EVP_PKEY_RSA)
@@ -87,9 +78,10 @@ EVP_PKEY *pkey;
87 return(0); 78 return(0);
88 } 79 }
89 80
90int EVP_PKEY_size(pkey) 81int EVP_PKEY_size(EVP_PKEY *pkey)
91EVP_PKEY *pkey;
92 { 82 {
83 if (pkey == NULL)
84 return(0);
93#ifndef NO_RSA 85#ifndef NO_RSA
94 if (pkey->type == EVP_PKEY_RSA) 86 if (pkey->type == EVP_PKEY_RSA)
95 return(RSA_size(pkey->pkey.rsa)); 87 return(RSA_size(pkey->pkey.rsa));
@@ -102,9 +94,7 @@ EVP_PKEY *pkey;
102 return(0); 94 return(0);
103 } 95 }
104 96
105int EVP_PKEY_save_parameters(pkey,mode) 97int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)
106EVP_PKEY *pkey;
107int mode;
108 { 98 {
109#ifndef NO_DSA 99#ifndef NO_DSA
110 if (pkey->type == EVP_PKEY_DSA) 100 if (pkey->type == EVP_PKEY_DSA)
@@ -119,8 +109,7 @@ int mode;
119 return(0); 109 return(0);
120 } 110 }
121 111
122int EVP_PKEY_copy_parameters(to,from) 112int EVP_PKEY_copy_parameters(EVP_PKEY *to, EVP_PKEY *from)
123EVP_PKEY *to,*from;
124 { 113 {
125 if (to->type != from->type) 114 if (to->type != from->type)
126 { 115 {
@@ -156,8 +145,7 @@ err:
156 return(0); 145 return(0);
157 } 146 }
158 147
159int EVP_PKEY_missing_parameters(pkey) 148int EVP_PKEY_missing_parameters(EVP_PKEY *pkey)
160EVP_PKEY *pkey;
161 { 149 {
162#ifndef NO_DSA 150#ifndef NO_DSA
163 if (pkey->type == EVP_PKEY_DSA) 151 if (pkey->type == EVP_PKEY_DSA)
@@ -172,8 +160,7 @@ EVP_PKEY *pkey;
172 return(0); 160 return(0);
173 } 161 }
174 162
175int EVP_PKEY_cmp_parameters(a,b) 163int EVP_PKEY_cmp_parameters(EVP_PKEY *a, EVP_PKEY *b)
176EVP_PKEY *a,*b;
177 { 164 {
178#ifndef NO_DSA 165#ifndef NO_DSA
179 if ((a->type == EVP_PKEY_DSA) && (b->type == EVP_PKEY_DSA)) 166 if ((a->type == EVP_PKEY_DSA) && (b->type == EVP_PKEY_DSA))
@@ -189,7 +176,7 @@ EVP_PKEY *a,*b;
189 return(-1); 176 return(-1);
190 } 177 }
191 178
192EVP_PKEY *EVP_PKEY_new() 179EVP_PKEY *EVP_PKEY_new(void)
193 { 180 {
194 EVP_PKEY *ret; 181 EVP_PKEY *ret;
195 182
@@ -207,10 +194,7 @@ EVP_PKEY *EVP_PKEY_new()
207 return(ret); 194 return(ret);
208 } 195 }
209 196
210int EVP_PKEY_assign(pkey,type,key) 197int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key)
211EVP_PKEY *pkey;
212int type;
213char *key;
214 { 198 {
215 if (pkey == NULL) return(0); 199 if (pkey == NULL) return(0);
216 if (pkey->pkey.ptr != NULL) 200 if (pkey->pkey.ptr != NULL)
@@ -221,8 +205,7 @@ char *key;
221 return(1); 205 return(1);
222 } 206 }
223 207
224int EVP_PKEY_type(type) 208int EVP_PKEY_type(int type)
225int type;
226 { 209 {
227 switch (type) 210 switch (type)
228 { 211 {
@@ -242,8 +225,7 @@ int type;
242 } 225 }
243 } 226 }
244 227
245void EVP_PKEY_free(x) 228void EVP_PKEY_free(EVP_PKEY *x)
246EVP_PKEY *x;
247 { 229 {
248 int i; 230 int i;
249 231
@@ -265,8 +247,7 @@ EVP_PKEY *x;
265 Free((char *)x); 247 Free((char *)x);
266 } 248 }
267 249
268static void EVP_PKEY_free_it(x) 250static void EVP_PKEY_free_it(EVP_PKEY *x)
269EVP_PKEY *x;
270 { 251 {
271 switch (x->type) 252 switch (x->type)
272 { 253 {