diff options
Diffstat (limited to 'src/lib/libcrypto/pem/pem.h')
-rw-r--r-- | src/lib/libcrypto/pem/pem.h | 551 |
1 files changed, 307 insertions, 244 deletions
diff --git a/src/lib/libcrypto/pem/pem.h b/src/lib/libcrypto/pem/pem.h index 55fbaeffe2..fc333e42c8 100644 --- a/src/lib/libcrypto/pem/pem.h +++ b/src/lib/libcrypto/pem/pem.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* crypto/pem/pem.org */ | 1 | /* crypto/pem/pem.h */ |
2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -56,14 +56,6 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
60 | * | ||
61 | * Always modify pem.org since pem.h is automatically generated from | ||
62 | * it during SSLeay configuration. | ||
63 | * | ||
64 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
65 | */ | ||
66 | |||
67 | #ifndef HEADER_PEM_H | 59 | #ifndef HEADER_PEM_H |
68 | #define HEADER_PEM_H | 60 | #define HEADER_PEM_H |
69 | 61 | ||
@@ -71,8 +63,11 @@ | |||
71 | extern "C" { | 63 | extern "C" { |
72 | #endif | 64 | #endif |
73 | 65 | ||
74 | #include "evp.h" | 66 | #include <openssl/evp.h> |
75 | #include "x509.h" | 67 | #include <openssl/x509.h> |
68 | #include <openssl/pem2.h> | ||
69 | |||
70 | #define PEM_BUFSIZE 1024 | ||
76 | 71 | ||
77 | #define PEM_OBJ_UNDEF 0 | 72 | #define PEM_OBJ_UNDEF 0 |
78 | #define PEM_OBJ_X509 1 | 73 | #define PEM_OBJ_X509 1 |
@@ -111,45 +106,17 @@ extern "C" { | |||
111 | #define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" | 106 | #define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" |
112 | #define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" | 107 | #define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" |
113 | #define PEM_STRING_X509_CRL "X509 CRL" | 108 | #define PEM_STRING_X509_CRL "X509 CRL" |
114 | #define PEM_STRING_EVP_PKEY "PRIVATE KEY" | 109 | #define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY" |
115 | #define PEM_STRING_RSA "RSA PRIVATE KEY" | 110 | #define PEM_STRING_RSA "RSA PRIVATE KEY" |
116 | #define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" | 111 | #define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY" |
117 | #define PEM_STRING_DSA "DSA PRIVATE KEY" | 112 | #define PEM_STRING_DSA "DSA PRIVATE KEY" |
118 | #define PEM_STRING_PKCS7 "PKCS7" | 113 | #define PEM_STRING_PKCS7 "PKCS7" |
114 | #define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY" | ||
115 | #define PEM_STRING_PKCS8INF "PRIVATE KEY" | ||
119 | #define PEM_STRING_DHPARAMS "DH PARAMETERS" | 116 | #define PEM_STRING_DHPARAMS "DH PARAMETERS" |
120 | #define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" | 117 | #define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" |
121 | #define PEM_STRING_DSAPARAMS "DSA PARAMETERS" | 118 | #define PEM_STRING_DSAPARAMS "DSA PARAMETERS" |
122 | 119 | ||
123 | #ifndef HEADER_ENVELOPE_H | ||
124 | |||
125 | #define EVP_ENCODE_CTX_SIZE 96 | ||
126 | #define EVP_MD_SIZE 60 | ||
127 | #define EVP_MD_CTX_SIZE 152 | ||
128 | #define EVP_CIPHER_SIZE 40 | ||
129 | #define EVP_CIPHER_CTX_SIZE 4212 | ||
130 | #define EVP_MAX_MD_SIZE 20 | ||
131 | |||
132 | typedef struct evp_encode_ctx_st | ||
133 | { | ||
134 | char data[EVP_ENCODE_CTX_SIZE]; | ||
135 | } EVP_ENCODE_CTX; | ||
136 | |||
137 | typedef struct env_md_ctx_st | ||
138 | { | ||
139 | char data[EVP_MD_CTX_SIZE]; | ||
140 | } EVP_MD_CTX; | ||
141 | |||
142 | typedef struct evp_cipher_st | ||
143 | { | ||
144 | char data[EVP_CIPHER_SIZE]; | ||
145 | } EVP_CIPHER; | ||
146 | |||
147 | typedef struct evp_cipher_ctx_st | ||
148 | { | ||
149 | char data[EVP_CIPHER_CTX_SIZE]; | ||
150 | } EVP_CIPHER_CTX; | ||
151 | #endif | ||
152 | |||
153 | 120 | ||
154 | typedef struct PEM_Encode_Seal_st | 121 | typedef struct PEM_Encode_Seal_st |
155 | { | 122 | { |
@@ -217,151 +184,322 @@ typedef struct pem_ctx_st | |||
217 | unsigned char *data; | 184 | unsigned char *data; |
218 | } PEM_CTX; | 185 | } PEM_CTX; |
219 | 186 | ||
187 | /* These macros make the PEM_read/PEM_write functions easier to maintain and | ||
188 | * write. Now they are all implemented with either: | ||
189 | * IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...) | ||
190 | */ | ||
191 | |||
192 | #ifdef NO_FP_API | ||
193 | |||
194 | #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/ | ||
195 | #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/ | ||
196 | #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/ | ||
197 | |||
198 | #else | ||
199 | |||
200 | #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ | ||
201 | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ | ||
202 | { \ | ||
203 | return((type *)PEM_ASN1_read((char *(*)())d2i_##asn1, str,fp,(char **)x,\ | ||
204 | cb,u)); \ | ||
205 | } \ | ||
206 | |||
207 | #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ | ||
208 | int PEM_write_##name(FILE *fp, type *x) \ | ||
209 | { \ | ||
210 | return(PEM_ASN1_write((int (*)())i2d_##asn1,str,fp, (char *)x, \ | ||
211 | NULL,NULL,0,NULL,NULL)); \ | ||
212 | } | ||
213 | |||
214 | #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ | ||
215 | int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | ||
216 | unsigned char *kstr, int klen, pem_password_cb *cb, \ | ||
217 | void *u) \ | ||
218 | { \ | ||
219 | return(PEM_ASN1_write((int (*)())i2d_##asn1,str,fp, \ | ||
220 | (char *)x,enc,kstr,klen,cb,u)); \ | ||
221 | } | ||
222 | |||
223 | #endif | ||
224 | |||
225 | #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ | ||
226 | type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ | ||
227 | { \ | ||
228 | return((type *)PEM_ASN1_read_bio((char *(*)())d2i_##asn1, str,bp,\ | ||
229 | (char **)x,cb,u)); \ | ||
230 | } | ||
231 | |||
232 | #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ | ||
233 | int PEM_write_bio_##name(BIO *bp, type *x) \ | ||
234 | { \ | ||
235 | return(PEM_ASN1_write_bio((int (*)())i2d_##asn1,str,bp, (char *)x, \ | ||
236 | NULL,NULL,0,NULL,NULL)); \ | ||
237 | } | ||
238 | |||
239 | #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ | ||
240 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | ||
241 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ | ||
242 | { \ | ||
243 | return(PEM_ASN1_write_bio((int (*)())i2d_##asn1,str,bp, \ | ||
244 | (char *)x,enc,kstr,klen,cb,u)); \ | ||
245 | } | ||
246 | |||
247 | #define IMPLEMENT_PEM_write(name, type, str, asn1) \ | ||
248 | IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ | ||
249 | IMPLEMENT_PEM_write_fp(name, type, str, asn1) | ||
250 | |||
251 | #define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ | ||
252 | IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ | ||
253 | IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) | ||
254 | |||
255 | #define IMPLEMENT_PEM_read(name, type, str, asn1) \ | ||
256 | IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ | ||
257 | IMPLEMENT_PEM_read_fp(name, type, str, asn1) | ||
258 | |||
259 | #define IMPLEMENT_PEM_rw(name, type, str, asn1) \ | ||
260 | IMPLEMENT_PEM_read(name, type, str, asn1) \ | ||
261 | IMPLEMENT_PEM_write(name, type, str, asn1) | ||
262 | |||
263 | #define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ | ||
264 | IMPLEMENT_PEM_read(name, type, str, asn1) \ | ||
265 | IMPLEMENT_PEM_write_cb(name, type, str, asn1) | ||
266 | |||
267 | /* These are the same except they are for the declarations */ | ||
268 | |||
269 | #if defined(WIN16) || defined(NO_FP_API) | ||
270 | |||
271 | #define DECLARE_PEM_read_fp(name, type) /**/ | ||
272 | #define DECLARE_PEM_write_fp(name, type) /**/ | ||
273 | #define DECLARE_PEM_write_cb_fp(name, type) /**/ | ||
274 | |||
275 | #else | ||
276 | |||
277 | #define DECLARE_PEM_read_fp(name, type) \ | ||
278 | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u); | ||
279 | |||
280 | #define DECLARE_PEM_write_fp(name, type) \ | ||
281 | int PEM_write_##name(FILE *fp, type *x); | ||
282 | |||
283 | #define DECLARE_PEM_write_cb_fp(name, type) \ | ||
284 | int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | ||
285 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u); | ||
286 | |||
287 | #endif | ||
288 | |||
289 | #ifdef HEADER_BIO_H | ||
290 | #define DECLARE_PEM_read_bio(name, type) \ | ||
291 | type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u); | ||
292 | |||
293 | #define DECLARE_PEM_write_bio(name, type) \ | ||
294 | int PEM_write_bio_##name(BIO *bp, type *x); | ||
295 | |||
296 | #define DECLARE_PEM_write_cb_bio(name, type) \ | ||
297 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | ||
298 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u); | ||
299 | |||
300 | #else | ||
301 | |||
302 | #define DECLARE_PEM_read_bio(name, type) /**/ | ||
303 | #define DECLARE_PEM_write_bio(name, type) /**/ | ||
304 | #define DECLARE_PEM_write_cb_bio(name, type) /**/ | ||
305 | |||
306 | #endif | ||
307 | |||
308 | #define DECLARE_PEM_write(name, type) \ | ||
309 | DECLARE_PEM_write_bio(name, type) \ | ||
310 | DECLARE_PEM_write_fp(name, type) | ||
311 | |||
312 | #define DECLARE_PEM_write_cb(name, type) \ | ||
313 | DECLARE_PEM_write_cb_bio(name, type) \ | ||
314 | DECLARE_PEM_write_cb_fp(name, type) | ||
315 | |||
316 | #define DECLARE_PEM_read(name, type) \ | ||
317 | DECLARE_PEM_read_bio(name, type) \ | ||
318 | DECLARE_PEM_read_fp(name, type) | ||
319 | |||
320 | #define DECLARE_PEM_rw(name, type) \ | ||
321 | DECLARE_PEM_read(name, type) \ | ||
322 | DECLARE_PEM_write(name, type) | ||
323 | |||
324 | #define DECLARE_PEM_rw_cb(name, type) \ | ||
325 | DECLARE_PEM_read(name, type) \ | ||
326 | DECLARE_PEM_write_cb(name, type) | ||
327 | |||
220 | #ifdef SSLEAY_MACROS | 328 | #ifdef SSLEAY_MACROS |
221 | 329 | ||
222 | #define PEM_write_SSL_SESSION(fp,x) \ | 330 | #define PEM_write_SSL_SESSION(fp,x) \ |
223 | PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \ | 331 | PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \ |
224 | PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL) | 332 | PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL) |
225 | #define PEM_write_X509(fp,x) \ | 333 | #define PEM_write_X509(fp,x) \ |
226 | PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \ | 334 | PEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \ |
227 | (char *)x, NULL,NULL,0,NULL) | 335 | (char *)x, NULL,NULL,0,NULL,NULL) |
228 | #define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \ | 336 | #define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \ |
229 | (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \ | 337 | (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \ |
230 | NULL,NULL,0,NULL) | 338 | NULL,NULL,0,NULL,NULL) |
231 | #define PEM_write_X509_CRL(fp,x) \ | 339 | #define PEM_write_X509_CRL(fp,x) \ |
232 | PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \ | 340 | PEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \ |
233 | fp,(char *)x, NULL,NULL,0,NULL) | 341 | fp,(char *)x, NULL,NULL,0,NULL,NULL) |
234 | #define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb) \ | 342 | #define PEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \ |
235 | PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\ | 343 | PEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\ |
236 | (char *)x,enc,kstr,klen,cb) | 344 | (char *)x,enc,kstr,klen,cb,u) |
237 | #define PEM_write_RSAPublicKey(fp,x) \ | 345 | #define PEM_write_RSAPublicKey(fp,x) \ |
238 | PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\ | 346 | PEM_ASN1_write((int (*)())i2d_RSAPublicKey,\ |
239 | PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL) | 347 | PEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL,NULL) |
240 | #define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb) \ | 348 | #define PEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \ |
241 | PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\ | 349 | PEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\ |
242 | (char *)x,enc,kstr,klen,cb) | 350 | (char *)x,enc,kstr,klen,cb,u) |
243 | #define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb) \ | 351 | #define PEM_write_PrivateKey(bp,x,enc,kstr,klen,cb,u) \ |
244 | PEM_ASN1_write((int (*)())i2d_PrivateKey,\ | 352 | PEM_ASN1_write((int (*)())i2d_PrivateKey,\ |
245 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ | 353 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ |
246 | bp,(char *)x,enc,kstr,klen,cb) | 354 | bp,(char *)x,enc,kstr,klen,cb,u) |
247 | #define PEM_write_PKCS7(fp,x) \ | 355 | #define PEM_write_PKCS7(fp,x) \ |
248 | PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \ | 356 | PEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \ |
249 | (char *)x, NULL,NULL,0,NULL) | 357 | (char *)x, NULL,NULL,0,NULL,NULL) |
250 | #define PEM_write_DHparams(fp,x) \ | 358 | #define PEM_write_DHparams(fp,x) \ |
251 | PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\ | 359 | PEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\ |
252 | (char *)x,NULL,NULL,0,NULL) | 360 | (char *)x,NULL,NULL,0,NULL,NULL) |
253 | 361 | ||
254 | #define PEM_read_SSL_SESSION(fp,x,cb) (SSL_SESSION *)PEM_ASN1_read( \ | 362 | #define PEM_write_NETSCAPE_CERT_SEQUENCE(fp,x) \ |
255 | (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb) | 363 | PEM_ASN1_write((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \ |
256 | #define PEM_read_X509(fp,x,cb) (X509 *)PEM_ASN1_read( \ | 364 | PEM_STRING_X509,fp, \ |
257 | (char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb) | 365 | (char *)x, NULL,NULL,0,NULL,NULL) |
258 | #define PEM_read_X509_REQ(fp,x,cb) (X509_REQ *)PEM_ASN1_read( \ | 366 | |
259 | (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb) | 367 | #define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \ |
260 | #define PEM_read_X509_CRL(fp,x,cb) (X509_CRL *)PEM_ASN1_read( \ | 368 | (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u) |
261 | (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb) | 369 | #define PEM_read_X509(fp,x,cb,u) (X509 *)PEM_ASN1_read( \ |
262 | #define PEM_read_RSAPrivateKey(fp,x,cb) (RSA *)PEM_ASN1_read( \ | 370 | (char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb,u) |
263 | (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb) | 371 | #define PEM_read_X509_REQ(fp,x,cb,u) (X509_REQ *)PEM_ASN1_read( \ |
264 | #define PEM_read_RSAPublicKey(fp,x,cb) (RSA *)PEM_ASN1_read( \ | 372 | (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb,u) |
265 | (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb) | 373 | #define PEM_read_X509_CRL(fp,x,cb,u) (X509_CRL *)PEM_ASN1_read( \ |
266 | #define PEM_read_DSAPrivateKey(fp,x,cb) (DSA *)PEM_ASN1_read( \ | 374 | (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb,u) |
267 | (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb) | 375 | #define PEM_read_RSAPrivateKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \ |
268 | #define PEM_read_PrivateKey(fp,x,cb) (EVP_PKEY *)PEM_ASN1_read( \ | 376 | (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb,u) |
269 | (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb) | 377 | #define PEM_read_RSAPublicKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \ |
270 | #define PEM_read_PKCS7(fp,x,cb) (PKCS7 *)PEM_ASN1_read( \ | 378 | (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb,u) |
271 | (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb) | 379 | #define PEM_read_DSAPrivateKey(fp,x,cb,u) (DSA *)PEM_ASN1_read( \ |
272 | #define PEM_read_DHparams(fp,x,cb) (DH *)PEM_ASN1_read( \ | 380 | (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb,u) |
273 | (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb) | 381 | #define PEM_read_PrivateKey(fp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read( \ |
382 | (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb,u) | ||
383 | #define PEM_read_PKCS7(fp,x,cb,u) (PKCS7 *)PEM_ASN1_read( \ | ||
384 | (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb,u) | ||
385 | #define PEM_read_DHparams(fp,x,cb,u) (DH *)PEM_ASN1_read( \ | ||
386 | (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb,u) | ||
387 | |||
388 | #define PEM_read_NETSCAPE_CERT_SEQUENCE(fp,x,cb,u) \ | ||
389 | (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read( \ | ||
390 | (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\ | ||
391 | (char **)x,cb,u) | ||
274 | 392 | ||
275 | #define PEM_write_bio_SSL_SESSION(bp,x) \ | 393 | #define PEM_write_bio_SSL_SESSION(bp,x) \ |
276 | PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \ | 394 | PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \ |
277 | PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL) | 395 | PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL,NULL) |
278 | #define PEM_write_bio_X509(bp,x) \ | 396 | #define PEM_write_bio_X509(bp,x) \ |
279 | PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \ | 397 | PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \ |
280 | (char *)x, NULL,NULL,0,NULL) | 398 | (char *)x, NULL,NULL,0,NULL,NULL) |
281 | #define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \ | 399 | #define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \ |
282 | (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \ | 400 | (int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \ |
283 | NULL,NULL,0,NULL) | 401 | NULL,NULL,0,NULL,NULL) |
284 | #define PEM_write_bio_X509_CRL(bp,x) \ | 402 | #define PEM_write_bio_X509_CRL(bp,x) \ |
285 | PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\ | 403 | PEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\ |
286 | bp,(char *)x, NULL,NULL,0,NULL) | 404 | bp,(char *)x, NULL,NULL,0,NULL,NULL) |
287 | #define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb) \ | 405 | #define PEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ |
288 | PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\ | 406 | PEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\ |
289 | bp,(char *)x,enc,kstr,klen,cb) | 407 | bp,(char *)x,enc,kstr,klen,cb,u) |
290 | #define PEM_write_bio_RSAPublicKey(bp,x) \ | 408 | #define PEM_write_bio_RSAPublicKey(bp,x) \ |
291 | PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \ | 409 | PEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \ |
292 | PEM_STRING_RSA_PUBLIC,\ | 410 | PEM_STRING_RSA_PUBLIC,\ |
293 | bp,(char *)x,NULL,NULL,0,NULL) | 411 | bp,(char *)x,NULL,NULL,0,NULL,NULL) |
294 | #define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb) \ | 412 | #define PEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \ |
295 | PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\ | 413 | PEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\ |
296 | bp,(char *)x,enc,kstr,klen,cb) | 414 | bp,(char *)x,enc,kstr,klen,cb,u) |
297 | #define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb) \ | 415 | #define PEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb,u) \ |
298 | PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\ | 416 | PEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\ |
299 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ | 417 | (((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\ |
300 | bp,(char *)x,enc,kstr,klen,cb) | 418 | bp,(char *)x,enc,kstr,klen,cb,u) |
301 | #define PEM_write_bio_PKCS7(bp,x) \ | 419 | #define PEM_write_bio_PKCS7(bp,x) \ |
302 | PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \ | 420 | PEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \ |
303 | (char *)x, NULL,NULL,0,NULL) | 421 | (char *)x, NULL,NULL,0,NULL,NULL) |
304 | #define PEM_write_bio_DHparams(bp,x) \ | 422 | #define PEM_write_bio_DHparams(bp,x) \ |
305 | PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\ | 423 | PEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\ |
306 | bp,(char *)x,NULL,NULL,0,NULL) | 424 | bp,(char *)x,NULL,NULL,0,NULL,NULL) |
307 | #define PEM_write_bio_DSAparams(bp,x) \ | 425 | #define PEM_write_bio_DSAparams(bp,x) \ |
308 | PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \ | 426 | PEM_ASN1_write_bio((int (*)())i2d_DSAparams, \ |
309 | PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL) | 427 | PEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL,NULL) |
310 | 428 | ||
311 | #define PEM_read_bio_SSL_SESSION(bp,x,cb) (SSL_SESSION *)PEM_ASN1_read_bio( \ | 429 | #define PEM_write_bio_NETSCAPE_CERT_SEQUENCE(bp,x) \ |
312 | (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb) | 430 | PEM_ASN1_write_bio((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \ |
313 | #define PEM_read_bio_X509(bp,x,cb) (X509 *)PEM_ASN1_read_bio( \ | 431 | PEM_STRING_X509,bp, \ |
314 | (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb) | 432 | (char *)x, NULL,NULL,0,NULL,NULL) |
315 | #define PEM_read_bio_X509_REQ(bp,x,cb) (X509_REQ *)PEM_ASN1_read_bio( \ | 433 | |
316 | (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb) | 434 | #define PEM_read_bio_SSL_SESSION(bp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read_bio( \ |
317 | #define PEM_read_bio_X509_CRL(bp,x,cb) (X509_CRL *)PEM_ASN1_read_bio( \ | 435 | (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb,u) |
318 | (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb) | 436 | #define PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \ |
319 | #define PEM_read_bio_RSAPrivateKey(bp,x,cb) (RSA *)PEM_ASN1_read_bio( \ | 437 | (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u) |
320 | (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb) | 438 | #define PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \ |
321 | #define PEM_read_bio_RSAPublicKey(bp,x,cb) (RSA *)PEM_ASN1_read_bio( \ | 439 | (char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb,u) |
322 | (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb) | 440 | #define PEM_read_bio_X509_CRL(bp,x,cb,u) (X509_CRL *)PEM_ASN1_read_bio( \ |
323 | #define PEM_read_bio_DSAPrivateKey(bp,x,cb) (DSA *)PEM_ASN1_read_bio( \ | 441 | (char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb,u) |
324 | (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb) | 442 | #define PEM_read_bio_RSAPrivateKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \ |
325 | #define PEM_read_bio_PrivateKey(bp,x,cb) (EVP_PKEY *)PEM_ASN1_read_bio( \ | 443 | (char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb,u) |
326 | (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb) | 444 | #define PEM_read_bio_RSAPublicKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \ |
327 | 445 | (char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb,u) | |
328 | #define PEM_read_bio_PKCS7(bp,x,cb) (PKCS7 *)PEM_ASN1_read_bio( \ | 446 | #define PEM_read_bio_DSAPrivateKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ |
329 | (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb) | 447 | (char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb,u) |
330 | #define PEM_read_bio_DHparams(bp,x,cb) (DH *)PEM_ASN1_read_bio( \ | 448 | #define PEM_read_bio_PrivateKey(bp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read_bio( \ |
331 | (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb) | 449 | (char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb,u) |
332 | #define PEM_read_bio_DSAparams(bp,x,cb) (DSA *)PEM_ASN1_read_bio( \ | 450 | |
333 | (char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb) | 451 | #define PEM_read_bio_PKCS7(bp,x,cb,u) (PKCS7 *)PEM_ASN1_read_bio( \ |
452 | (char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb,u) | ||
453 | #define PEM_read_bio_DHparams(bp,x,cb,u) (DH *)PEM_ASN1_read_bio( \ | ||
454 | (char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb,u) | ||
455 | #define PEM_read_bio_DSAparams(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \ | ||
456 | (char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb,u) | ||
457 | |||
458 | #define PEM_read_bio_NETSCAPE_CERT_SEQUENCE(bp,x,cb,u) \ | ||
459 | (NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read_bio( \ | ||
460 | (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,bp,\ | ||
461 | (char **)x,cb,u) | ||
334 | 462 | ||
335 | #endif | 463 | #endif |
336 | 464 | ||
337 | #ifndef NOPROTO | 465 | #if 1 |
466 | /* "userdata": new with OpenSSL 0.9.4 */ | ||
467 | typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata); | ||
468 | #else | ||
469 | /* OpenSSL 0.9.3, 0.9.3a */ | ||
470 | typedef int pem_password_cb(char *buf, int size, int rwflag); | ||
471 | #endif | ||
472 | |||
338 | int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); | 473 | int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher); |
339 | int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, | 474 | int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len, |
340 | int (*callback)()); | 475 | pem_password_cb *callback,void *u); |
341 | 476 | ||
342 | #ifdef HEADER_BIO_H | 477 | #ifdef HEADER_BIO_H |
343 | int PEM_read_bio(BIO *bp, char **name, char **header, | 478 | int PEM_read_bio(BIO *bp, char **name, char **header, |
344 | unsigned char **data,long *len); | 479 | unsigned char **data,long *len); |
345 | int PEM_write_bio(BIO *bp,char *name,char *hdr,unsigned char *data, | 480 | int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data, |
346 | long len); | 481 | long len); |
347 | char * PEM_ASN1_read_bio(char *(*d2i)(),char *name,BIO *bp,char **x, | 482 | char * PEM_ASN1_read_bio(char *(*d2i)(),const char *name,BIO *bp,char **x, |
348 | int (*cb)()); | 483 | pem_password_cb *cb, void *u); |
349 | int PEM_ASN1_write_bio(int (*i2d)(),char *name,BIO *bp,char *x, | 484 | int PEM_ASN1_write_bio(int (*i2d)(),const char *name,BIO *bp,char *x, |
350 | EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); | 485 | const EVP_CIPHER *enc,unsigned char *kstr,int klen, |
351 | STACK * PEM_X509_INFO_read_bio(BIO *bp, STACK *sk, int (*cb)()); | 486 | pem_password_cb *cb, void *u); |
487 | STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); | ||
352 | int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, | 488 | int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, |
353 | unsigned char *kstr, int klen, int (*cb)()); | 489 | unsigned char *kstr, int klen, pem_password_cb *cd, void *u); |
354 | #endif | 490 | #endif |
355 | 491 | ||
356 | #ifndef WIN16 | 492 | #ifndef WIN16 |
357 | int PEM_read(FILE *fp, char **name, char **header, | 493 | int PEM_read(FILE *fp, char **name, char **header, |
358 | unsigned char **data,long *len); | 494 | unsigned char **data,long *len); |
359 | int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); | 495 | int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); |
360 | char * PEM_ASN1_read(char *(*d2i)(),char *name,FILE *fp,char **x, | 496 | char * PEM_ASN1_read(char *(*d2i)(),const char *name,FILE *fp,char **x, |
361 | int (*cb)()); | 497 | pem_password_cb *cb, void *u); |
362 | int PEM_ASN1_write(int (*i2d)(),char *name,FILE *fp,char *x, | 498 | int PEM_ASN1_write(int (*i2d)(),const char *name,FILE *fp,char *x, |
363 | EVP_CIPHER *enc,unsigned char *kstr,int klen,int (*callback)()); | 499 | const EVP_CIPHER *enc,unsigned char *kstr,int klen, |
364 | STACK * PEM_X509_INFO_read(FILE *fp, STACK *sk, int (*cb)()); | 500 | pem_password_cb *callback, void *u); |
501 | STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, | ||
502 | pem_password_cb *cb, void *u); | ||
365 | #endif | 503 | #endif |
366 | 504 | ||
367 | int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, | 505 | int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, |
@@ -380,142 +518,64 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, | |||
380 | void ERR_load_PEM_strings(void); | 518 | void ERR_load_PEM_strings(void); |
381 | 519 | ||
382 | void PEM_proc_type(char *buf, int type); | 520 | void PEM_proc_type(char *buf, int type); |
383 | void PEM_dek_info(char *buf, char *type, int len, char *str); | 521 | void PEM_dek_info(char *buf, const char *type, int len, char *str); |
384 | 522 | ||
385 | #ifndef SSLEAY_MACROS | 523 | #ifndef SSLEAY_MACROS |
386 | 524 | ||
387 | #ifndef WIN16 | 525 | #ifdef VMS |
388 | X509 *PEM_read_X509(FILE *fp,X509 **x,int (*cb)()); | 526 | #include <openssl/vms_idhacks.h> |
389 | X509_REQ *PEM_read_X509_REQ(FILE *fp,X509_REQ **x,int (*cb)()); | ||
390 | X509_CRL *PEM_read_X509_CRL(FILE *fp,X509_CRL **x,int (*cb)()); | ||
391 | RSA *PEM_read_RSAPrivateKey(FILE *fp,RSA **x,int (*cb)()); | ||
392 | RSA *PEM_read_RSAPublicKey(FILE *fp,RSA **x,int (*cb)()); | ||
393 | DSA *PEM_read_DSAPrivateKey(FILE *fp,DSA **x,int (*cb)()); | ||
394 | EVP_PKEY *PEM_read_PrivateKey(FILE *fp,EVP_PKEY **x,int (*cb)()); | ||
395 | PKCS7 *PEM_read_PKCS7(FILE *fp,PKCS7 **x,int (*cb)()); | ||
396 | DH *PEM_read_DHparams(FILE *fp,DH **x,int (*cb)()); | ||
397 | DSA *PEM_read_DSAparams(FILE *fp,DSA **x,int (*cb)()); | ||
398 | int PEM_write_X509(FILE *fp,X509 *x); | ||
399 | int PEM_write_X509_REQ(FILE *fp,X509_REQ *x); | ||
400 | int PEM_write_X509_CRL(FILE *fp,X509_CRL *x); | ||
401 | int PEM_write_RSAPrivateKey(FILE *fp,RSA *x,EVP_CIPHER *enc,unsigned char *kstr, | ||
402 | int klen,int (*cb)()); | ||
403 | int PEM_write_RSAPublicKey(FILE *fp,RSA *x); | ||
404 | int PEM_write_DSAPrivateKey(FILE *fp,DSA *x,EVP_CIPHER *enc,unsigned char *kstr, | ||
405 | int klen,int (*cb)()); | ||
406 | int PEM_write_PrivateKey(FILE *fp,EVP_PKEY *x,EVP_CIPHER *enc, | ||
407 | unsigned char *kstr,int klen,int (*cb)()); | ||
408 | int PEM_write_PKCS7(FILE *fp,PKCS7 *x); | ||
409 | int PEM_write_DHparams(FILE *fp,DH *x); | ||
410 | int PEM_write_DSAparams(FILE *fp,DSA *x); | ||
411 | #endif | 527 | #endif |
412 | 528 | ||
413 | #ifdef HEADER_BIO_H | 529 | DECLARE_PEM_rw(X509, X509) |
414 | X509 *PEM_read_bio_X509(BIO *bp,X509 **x,int (*cb)()); | 530 | |
415 | X509_REQ *PEM_read_bio_X509_REQ(BIO *bp,X509_REQ **x,int (*cb)()); | 531 | DECLARE_PEM_rw(X509_REQ, X509_REQ) |
416 | X509_CRL *PEM_read_bio_X509_CRL(BIO *bp,X509_CRL **x,int (*cb)()); | 532 | |
417 | RSA *PEM_read_bio_RSAPrivateKey(BIO *bp,RSA **x,int (*cb)()); | 533 | DECLARE_PEM_rw(X509_CRL, X509_CRL) |
418 | RSA *PEM_read_bio_RSAPublicKey(BIO *bp,RSA **x,int (*cb)()); | 534 | |
419 | DSA *PEM_read_bio_DSAPrivateKey(BIO *bp,DSA **x,int (*cb)()); | 535 | DECLARE_PEM_rw(PKCS7, PKCS7) |
420 | EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp,EVP_PKEY **x,int (*cb)()); | 536 | |
421 | PKCS7 *PEM_read_bio_PKCS7(BIO *bp,PKCS7 **x,int (*cb)()); | 537 | DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) |
422 | DH *PEM_read_bio_DHparams(BIO *bp,DH **x,int (*cb)()); | 538 | |
423 | DSA *PEM_read_bio_DSAparams(BIO *bp,DSA **x,int (*cb)()); | 539 | DECLARE_PEM_rw(PKCS8, X509_SIG) |
424 | int PEM_write_bio_X509(BIO *bp,X509 *x); | 540 | |
425 | int PEM_write_bio_X509_REQ(BIO *bp,X509_REQ *x); | 541 | DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) |
426 | int PEM_write_bio_X509_CRL(BIO *bp,X509_CRL *x); | 542 | |
427 | int PEM_write_bio_RSAPrivateKey(BIO *fp,RSA *x,EVP_CIPHER *enc, | 543 | #ifndef NO_RSA |
428 | unsigned char *kstr,int klen,int (*cb)()); | 544 | |
429 | int PEM_write_bio_RSAPublicKey(BIO *fp,RSA *x); | 545 | DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) |
430 | int PEM_write_bio_DSAPrivateKey(BIO *fp,DSA *x,EVP_CIPHER *enc, | 546 | |
431 | unsigned char *kstr,int klen,int (*cb)()); | 547 | DECLARE_PEM_rw(RSAPublicKey, RSA) |
432 | int PEM_write_bio_PrivateKey(BIO *fp,EVP_PKEY *x,EVP_CIPHER *enc, | 548 | |
433 | unsigned char *kstr,int klen,int (*cb)()); | ||
434 | int PEM_write_bio_PKCS7(BIO *bp,PKCS7 *x); | ||
435 | int PEM_write_bio_DHparams(BIO *bp,DH *x); | ||
436 | int PEM_write_bio_DSAparams(BIO *bp,DSA *x); | ||
437 | #endif | 549 | #endif |
438 | 550 | ||
439 | #endif /* SSLEAY_MACROS */ | 551 | #ifndef NO_DSA |
440 | 552 | ||
553 | DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) | ||
441 | 554 | ||
442 | #else | 555 | DECLARE_PEM_rw(DSAparams, DSA) |
443 | 556 | ||
444 | int PEM_get_EVP_CIPHER_INFO(); | ||
445 | int PEM_do_header(); | ||
446 | int PEM_read_bio(); | ||
447 | int PEM_write_bio(); | ||
448 | #ifndef WIN16 | ||
449 | int PEM_read(); | ||
450 | int PEM_write(); | ||
451 | STACK * PEM_X509_INFO_read(); | ||
452 | char * PEM_ASN1_read(); | ||
453 | int PEM_ASN1_write(); | ||
454 | #endif | 557 | #endif |
455 | STACK * PEM_X509_INFO_read_bio(); | ||
456 | int PEM_X509_INFO_write_bio(); | ||
457 | char * PEM_ASN1_read_bio(); | ||
458 | int PEM_ASN1_write_bio(); | ||
459 | int PEM_SealInit(); | ||
460 | void PEM_SealUpdate(); | ||
461 | int PEM_SealFinal(); | ||
462 | int PEM_SignFinal(); | ||
463 | 558 | ||
464 | void ERR_load_PEM_strings(); | 559 | #ifndef NO_DH |
465 | 560 | ||
466 | void PEM_proc_type(); | 561 | DECLARE_PEM_rw(DHparams, DH) |
467 | void PEM_dek_info(); | ||
468 | 562 | ||
469 | #ifndef SSLEAY_MACROS | ||
470 | #ifndef WIN16 | ||
471 | X509 *PEM_read_X509(); | ||
472 | X509_REQ *PEM_read_X509_REQ(); | ||
473 | X509_CRL *PEM_read_X509_CRL(); | ||
474 | RSA *PEM_read_RSAPrivateKey(); | ||
475 | RSA *PEM_read_RSAPublicKey(); | ||
476 | DSA *PEM_read_DSAPrivateKey(); | ||
477 | EVP_PKEY *PEM_read_PrivateKey(); | ||
478 | PKCS7 *PEM_read_PKCS7(); | ||
479 | DH *PEM_read_DHparams(); | ||
480 | DSA *PEM_read_DSAparams(); | ||
481 | int PEM_write_X509(); | ||
482 | int PEM_write_X509_REQ(); | ||
483 | int PEM_write_X509_CRL(); | ||
484 | int PEM_write_RSAPrivateKey(); | ||
485 | int PEM_write_RSAPublicKey(); | ||
486 | int PEM_write_DSAPrivateKey(); | ||
487 | int PEM_write_PrivateKey(); | ||
488 | int PEM_write_PKCS7(); | ||
489 | int PEM_write_DHparams(); | ||
490 | int PEM_write_DSAparams(); | ||
491 | #endif | 563 | #endif |
492 | 564 | ||
493 | X509 *PEM_read_bio_X509(); | 565 | DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY) |
494 | X509_REQ *PEM_read_bio_X509_REQ(); | ||
495 | X509_CRL *PEM_read_bio_X509_CRL(); | ||
496 | RSA *PEM_read_bio_RSAPrivateKey(); | ||
497 | RSA *PEM_read_bio_RSAPublicKey(); | ||
498 | DSA *PEM_read_bio_DSAPrivateKey(); | ||
499 | EVP_PKEY *PEM_read_bio_PrivateKey(); | ||
500 | PKCS7 *PEM_read_bio_PKCS7(); | ||
501 | DH *PEM_read_bio_DHparams(); | ||
502 | DSA *PEM_read_bio_DSAparams(); | ||
503 | int PEM_write_bio_X509(); | ||
504 | int PEM_write_bio_X509_REQ(); | ||
505 | int PEM_write_bio_X509_CRL(); | ||
506 | int PEM_write_bio_RSAPrivateKey(); | ||
507 | int PEM_write_bio_RSAPublicKey(); | ||
508 | int PEM_write_bio_DSAPrivateKey(); | ||
509 | int PEM_write_bio_PrivateKey(); | ||
510 | int PEM_write_bio_PKCS7(); | ||
511 | int PEM_write_bio_DHparams(); | ||
512 | int PEM_write_bio_DSAparams(); | ||
513 | 566 | ||
567 | int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *, | ||
568 | char *, int, pem_password_cb *, void *); | ||
569 | int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc, | ||
570 | char *kstr,int klen, pem_password_cb *cd, void *u); | ||
514 | #endif /* SSLEAY_MACROS */ | 571 | #endif /* SSLEAY_MACROS */ |
515 | 572 | ||
516 | #endif | ||
517 | 573 | ||
518 | /* BEGIN ERROR CODES */ | 574 | /* BEGIN ERROR CODES */ |
575 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
576 | * made after this point may be overwritten when the script is next run. | ||
577 | */ | ||
578 | |||
519 | /* Error codes for the PEM functions. */ | 579 | /* Error codes for the PEM functions. */ |
520 | 580 | ||
521 | /* Function codes. */ | 581 | /* Function codes. */ |
@@ -526,6 +586,7 @@ int PEM_write_bio_DSAparams(); | |||
526 | #define PEM_F_PEM_ASN1_WRITE 104 | 586 | #define PEM_F_PEM_ASN1_WRITE 104 |
527 | #define PEM_F_PEM_ASN1_WRITE_BIO 105 | 587 | #define PEM_F_PEM_ASN1_WRITE_BIO 105 |
528 | #define PEM_F_PEM_DO_HEADER 106 | 588 | #define PEM_F_PEM_DO_HEADER 106 |
589 | #define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118 | ||
529 | #define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 | 590 | #define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 |
530 | #define PEM_F_PEM_READ 108 | 591 | #define PEM_F_PEM_READ 108 |
531 | #define PEM_F_PEM_READ_BIO 109 | 592 | #define PEM_F_PEM_READ_BIO 109 |
@@ -534,6 +595,7 @@ int PEM_write_bio_DSAparams(); | |||
534 | #define PEM_F_PEM_SIGNFINAL 112 | 595 | #define PEM_F_PEM_SIGNFINAL 112 |
535 | #define PEM_F_PEM_WRITE 113 | 596 | #define PEM_F_PEM_WRITE 113 |
536 | #define PEM_F_PEM_WRITE_BIO 114 | 597 | #define PEM_F_PEM_WRITE_BIO 114 |
598 | #define PEM_F_PEM_WRITE_BIO_PKCS8PRIVATEKEY 119 | ||
537 | #define PEM_F_PEM_X509_INFO_READ 115 | 599 | #define PEM_F_PEM_X509_INFO_READ 115 |
538 | #define PEM_F_PEM_X509_INFO_READ_BIO 116 | 600 | #define PEM_F_PEM_X509_INFO_READ_BIO 116 |
539 | #define PEM_F_PEM_X509_INFO_WRITE_BIO 117 | 601 | #define PEM_F_PEM_X509_INFO_WRITE_BIO 117 |
@@ -544,6 +606,7 @@ int PEM_write_bio_DSAparams(); | |||
544 | #define PEM_R_BAD_END_LINE 102 | 606 | #define PEM_R_BAD_END_LINE 102 |
545 | #define PEM_R_BAD_IV_CHARS 103 | 607 | #define PEM_R_BAD_IV_CHARS 103 |
546 | #define PEM_R_BAD_PASSWORD_READ 104 | 608 | #define PEM_R_BAD_PASSWORD_READ 104 |
609 | #define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115 | ||
547 | #define PEM_R_NOT_DEK_INFO 105 | 610 | #define PEM_R_NOT_DEK_INFO 105 |
548 | #define PEM_R_NOT_ENCRYPTED 106 | 611 | #define PEM_R_NOT_ENCRYPTED 106 |
549 | #define PEM_R_NOT_PROC_TYPE 107 | 612 | #define PEM_R_NOT_PROC_TYPE 107 |
@@ -554,7 +617,7 @@ int PEM_write_bio_DSAparams(); | |||
554 | #define PEM_R_SHORT_HEADER 112 | 617 | #define PEM_R_SHORT_HEADER 112 |
555 | #define PEM_R_UNSUPPORTED_CIPHER 113 | 618 | #define PEM_R_UNSUPPORTED_CIPHER 113 |
556 | #define PEM_R_UNSUPPORTED_ENCRYPTION 114 | 619 | #define PEM_R_UNSUPPORTED_ENCRYPTION 114 |
557 | 620 | ||
558 | #ifdef __cplusplus | 621 | #ifdef __cplusplus |
559 | } | 622 | } |
560 | #endif | 623 | #endif |