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