diff options
Diffstat (limited to 'src/lib/libcrypto/pem/pem.h')
| -rw-r--r-- | src/lib/libcrypto/pem/pem.h | 173 |
1 files changed, 139 insertions, 34 deletions
diff --git a/src/lib/libcrypto/pem/pem.h b/src/lib/libcrypto/pem/pem.h index d330cbf9a3..670afa670b 100644 --- a/src/lib/libcrypto/pem/pem.h +++ b/src/lib/libcrypto/pem/pem.h | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | #ifndef HEADER_PEM_H | 59 | #ifndef HEADER_PEM_H |
| 60 | #define HEADER_PEM_H | 60 | #define HEADER_PEM_H |
| 61 | 61 | ||
| 62 | #include <openssl/e_os2.h> | ||
| 62 | #ifndef OPENSSL_NO_BIO | 63 | #ifndef OPENSSL_NO_BIO |
| 63 | #include <openssl/bio.h> | 64 | #include <openssl/bio.h> |
| 64 | #endif | 65 | #endif |
| @@ -68,7 +69,6 @@ | |||
| 68 | #include <openssl/evp.h> | 69 | #include <openssl/evp.h> |
| 69 | #include <openssl/x509.h> | 70 | #include <openssl/x509.h> |
| 70 | #include <openssl/pem2.h> | 71 | #include <openssl/pem2.h> |
| 71 | #include <openssl/e_os2.h> | ||
| 72 | 72 | ||
| 73 | #ifdef __cplusplus | 73 | #ifdef __cplusplus |
| 74 | extern "C" { | 74 | extern "C" { |
| @@ -91,6 +91,9 @@ extern "C" { | |||
| 91 | #define PEM_OBJ_DHPARAMS 17 | 91 | #define PEM_OBJ_DHPARAMS 17 |
| 92 | #define PEM_OBJ_DSAPARAMS 18 | 92 | #define PEM_OBJ_DSAPARAMS 18 |
| 93 | #define PEM_OBJ_PRIV_RSA_PUBLIC 19 | 93 | #define PEM_OBJ_PRIV_RSA_PUBLIC 19 |
| 94 | #define PEM_OBJ_PRIV_ECDSA 20 | ||
| 95 | #define PEM_OBJ_PUB_ECDSA 21 | ||
| 96 | #define PEM_OBJ_ECPARAMETERS 22 | ||
| 94 | 97 | ||
| 95 | #define PEM_ERROR 30 | 98 | #define PEM_ERROR 30 |
| 96 | #define PEM_DEK_DES_CBC 40 | 99 | #define PEM_DEK_DES_CBC 40 |
| @@ -110,6 +113,7 @@ extern "C" { | |||
| 110 | 113 | ||
| 111 | #define PEM_STRING_X509_OLD "X509 CERTIFICATE" | 114 | #define PEM_STRING_X509_OLD "X509 CERTIFICATE" |
| 112 | #define PEM_STRING_X509 "CERTIFICATE" | 115 | #define PEM_STRING_X509 "CERTIFICATE" |
| 116 | #define PEM_STRING_X509_PAIR "CERTIFICATE PAIR" | ||
| 113 | #define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" | 117 | #define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE" |
| 114 | #define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" | 118 | #define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST" |
| 115 | #define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" | 119 | #define PEM_STRING_X509_REQ "CERTIFICATE REQUEST" |
| @@ -126,6 +130,10 @@ extern "C" { | |||
| 126 | #define PEM_STRING_DHPARAMS "DH PARAMETERS" | 130 | #define PEM_STRING_DHPARAMS "DH PARAMETERS" |
| 127 | #define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" | 131 | #define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS" |
| 128 | #define PEM_STRING_DSAPARAMS "DSA PARAMETERS" | 132 | #define PEM_STRING_DSAPARAMS "DSA PARAMETERS" |
| 133 | #define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY" | ||
| 134 | #define PEM_STRING_ECPARAMETERS "EC PARAMETERS" | ||
| 135 | #define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY" | ||
| 136 | #define PEM_STRING_CMS "CMS" | ||
| 129 | 137 | ||
| 130 | /* Note that this structure is initialised by PEM_SealInit and cleaned up | 138 | /* Note that this structure is initialised by PEM_SealInit and cleaned up |
| 131 | by PEM_SealFinal (at least for now) */ | 139 | by PEM_SealFinal (at least for now) */ |
| @@ -213,24 +221,50 @@ typedef struct pem_ctx_st | |||
| 213 | #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ | 221 | #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \ |
| 214 | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ | 222 | type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\ |
| 215 | { \ | 223 | { \ |
| 216 | return((type *)PEM_ASN1_read((char *(*)())d2i_##asn1, str,fp,(char **)x,\ | 224 | return (type*)PEM_ASN1_read(CHECKED_D2I_OF(type, d2i_##asn1), \ |
| 217 | cb,u)); \ | 225 | str, fp, \ |
| 218 | } \ | 226 | CHECKED_PPTR_OF(type, x), \ |
| 227 | cb, u); \ | ||
| 228 | } | ||
| 219 | 229 | ||
| 220 | #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ | 230 | #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \ |
| 221 | int PEM_write_##name(FILE *fp, type *x) \ | 231 | int PEM_write_##name(FILE *fp, type *x) \ |
| 222 | { \ | 232 | { \ |
| 223 | return(PEM_ASN1_write((int (*)())i2d_##asn1,str,fp, (char *)x, \ | 233 | return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \ |
| 224 | NULL,NULL,0,NULL,NULL)); \ | 234 | str, fp, \ |
| 225 | } | 235 | CHECKED_PTR_OF(type, x), \ |
| 236 | NULL, NULL, 0, NULL, NULL); \ | ||
| 237 | } | ||
| 238 | |||
| 239 | #define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \ | ||
| 240 | int PEM_write_##name(FILE *fp, const type *x) \ | ||
| 241 | { \ | ||
| 242 | return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \ | ||
| 243 | str, fp, \ | ||
| 244 | CHECKED_PTR_OF(const type, x), \ | ||
| 245 | NULL, NULL, 0, NULL, NULL); \ | ||
| 246 | } | ||
| 226 | 247 | ||
| 227 | #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ | 248 | #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \ |
| 228 | int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | 249 | int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ |
| 229 | unsigned char *kstr, int klen, pem_password_cb *cb, \ | 250 | unsigned char *kstr, int klen, pem_password_cb *cb, \ |
| 230 | void *u) \ | 251 | void *u) \ |
| 231 | { \ | 252 | { \ |
| 232 | return(PEM_ASN1_write((int (*)())i2d_##asn1,str,fp, \ | 253 | return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \ |
| 233 | (char *)x,enc,kstr,klen,cb,u)); \ | 254 | str, fp, \ |
| 255 | CHECKED_PTR_OF(type, x), \ | ||
| 256 | enc, kstr, klen, cb, u); \ | ||
| 257 | } | ||
| 258 | |||
| 259 | #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \ | ||
| 260 | int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | ||
| 261 | unsigned char *kstr, int klen, pem_password_cb *cb, \ | ||
| 262 | void *u) \ | ||
| 263 | { \ | ||
| 264 | return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \ | ||
| 265 | str, fp, \ | ||
| 266 | CHECKED_PTR_OF(const type, x), \ | ||
| 267 | enc, kstr, klen, cb, u); \ | ||
| 234 | } | 268 | } |
| 235 | 269 | ||
| 236 | #endif | 270 | #endif |
| @@ -238,33 +272,66 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | |||
| 238 | #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ | 272 | #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ |
| 239 | type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ | 273 | type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\ |
| 240 | { \ | 274 | { \ |
| 241 | return((type *)PEM_ASN1_read_bio((char *(*)())d2i_##asn1, str,bp,\ | 275 | return (type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i_##asn1), \ |
| 242 | (char **)x,cb,u)); \ | 276 | str, bp, \ |
| 277 | CHECKED_PPTR_OF(type, x), \ | ||
| 278 | cb, u); \ | ||
| 243 | } | 279 | } |
| 244 | 280 | ||
| 245 | #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ | 281 | #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ |
| 246 | int PEM_write_bio_##name(BIO *bp, type *x) \ | 282 | int PEM_write_bio_##name(BIO *bp, type *x) \ |
| 247 | { \ | 283 | { \ |
| 248 | return(PEM_ASN1_write_bio((int (*)())i2d_##asn1,str,bp, (char *)x, \ | 284 | return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \ |
| 249 | NULL,NULL,0,NULL,NULL)); \ | 285 | str, bp, \ |
| 286 | CHECKED_PTR_OF(type, x), \ | ||
| 287 | NULL, NULL, 0, NULL, NULL); \ | ||
| 288 | } | ||
| 289 | |||
| 290 | #define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ | ||
| 291 | int PEM_write_bio_##name(BIO *bp, const type *x) \ | ||
| 292 | { \ | ||
| 293 | return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \ | ||
| 294 | str, bp, \ | ||
| 295 | CHECKED_PTR_OF(const type, x), \ | ||
| 296 | NULL, NULL, 0, NULL, NULL); \ | ||
| 250 | } | 297 | } |
| 251 | 298 | ||
| 252 | #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ | 299 | #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ |
| 253 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | 300 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ |
| 254 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ | 301 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ |
| 255 | { \ | 302 | { \ |
| 256 | return(PEM_ASN1_write_bio((int (*)())i2d_##asn1,str,bp, \ | 303 | return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \ |
| 257 | (char *)x,enc,kstr,klen,cb,u)); \ | 304 | str, bp, \ |
| 305 | CHECKED_PTR_OF(type, x), \ | ||
| 306 | enc, kstr, klen, cb, u); \ | ||
| 307 | } | ||
| 308 | |||
| 309 | #define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ | ||
| 310 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | ||
| 311 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \ | ||
| 312 | { \ | ||
| 313 | return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \ | ||
| 314 | str, bp, \ | ||
| 315 | CHECKED_PTR_OF(const type, x), \ | ||
| 316 | enc, kstr, klen, cb, u); \ | ||
| 258 | } | 317 | } |
| 259 | 318 | ||
| 260 | #define IMPLEMENT_PEM_write(name, type, str, asn1) \ | 319 | #define IMPLEMENT_PEM_write(name, type, str, asn1) \ |
| 261 | IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ | 320 | IMPLEMENT_PEM_write_bio(name, type, str, asn1) \ |
| 262 | IMPLEMENT_PEM_write_fp(name, type, str, asn1) | 321 | IMPLEMENT_PEM_write_fp(name, type, str, asn1) |
| 263 | 322 | ||
| 323 | #define IMPLEMENT_PEM_write_const(name, type, str, asn1) \ | ||
| 324 | IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \ | ||
| 325 | IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) | ||
| 326 | |||
| 264 | #define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ | 327 | #define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \ |
| 265 | IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ | 328 | IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \ |
| 266 | IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) | 329 | IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) |
| 267 | 330 | ||
| 331 | #define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \ | ||
| 332 | IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \ | ||
| 333 | IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) | ||
| 334 | |||
| 268 | #define IMPLEMENT_PEM_read(name, type, str, asn1) \ | 335 | #define IMPLEMENT_PEM_read(name, type, str, asn1) \ |
| 269 | IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ | 336 | IMPLEMENT_PEM_read_bio(name, type, str, asn1) \ |
| 270 | IMPLEMENT_PEM_read_fp(name, type, str, asn1) | 337 | IMPLEMENT_PEM_read_fp(name, type, str, asn1) |
| @@ -273,6 +340,10 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | |||
| 273 | IMPLEMENT_PEM_read(name, type, str, asn1) \ | 340 | IMPLEMENT_PEM_read(name, type, str, asn1) \ |
| 274 | IMPLEMENT_PEM_write(name, type, str, asn1) | 341 | IMPLEMENT_PEM_write(name, type, str, asn1) |
| 275 | 342 | ||
| 343 | #define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \ | ||
| 344 | IMPLEMENT_PEM_read(name, type, str, asn1) \ | ||
| 345 | IMPLEMENT_PEM_write_const(name, type, str, asn1) | ||
| 346 | |||
| 276 | #define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ | 347 | #define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \ |
| 277 | IMPLEMENT_PEM_read(name, type, str, asn1) \ | 348 | IMPLEMENT_PEM_read(name, type, str, asn1) \ |
| 278 | IMPLEMENT_PEM_write_cb(name, type, str, asn1) | 349 | IMPLEMENT_PEM_write_cb(name, type, str, asn1) |
| @@ -293,6 +364,9 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | |||
| 293 | #define DECLARE_PEM_write_fp(name, type) \ | 364 | #define DECLARE_PEM_write_fp(name, type) \ |
| 294 | int PEM_write_##name(FILE *fp, type *x); | 365 | int PEM_write_##name(FILE *fp, type *x); |
| 295 | 366 | ||
| 367 | #define DECLARE_PEM_write_fp_const(name, type) \ | ||
| 368 | int PEM_write_##name(FILE *fp, const type *x); | ||
| 369 | |||
| 296 | #define DECLARE_PEM_write_cb_fp(name, type) \ | 370 | #define DECLARE_PEM_write_cb_fp(name, type) \ |
| 297 | int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ | 371 | int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \ |
| 298 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u); | 372 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u); |
| @@ -306,6 +380,9 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | |||
| 306 | #define DECLARE_PEM_write_bio(name, type) \ | 380 | #define DECLARE_PEM_write_bio(name, type) \ |
| 307 | int PEM_write_bio_##name(BIO *bp, type *x); | 381 | int PEM_write_bio_##name(BIO *bp, type *x); |
| 308 | 382 | ||
| 383 | #define DECLARE_PEM_write_bio_const(name, type) \ | ||
| 384 | int PEM_write_bio_##name(BIO *bp, const type *x); | ||
| 385 | |||
| 309 | #define DECLARE_PEM_write_cb_bio(name, type) \ | 386 | #define DECLARE_PEM_write_cb_bio(name, type) \ |
| 310 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | 387 | int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ |
| 311 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u); | 388 | unsigned char *kstr, int klen, pem_password_cb *cb, void *u); |
| @@ -322,6 +399,10 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | |||
| 322 | DECLARE_PEM_write_bio(name, type) \ | 399 | DECLARE_PEM_write_bio(name, type) \ |
| 323 | DECLARE_PEM_write_fp(name, type) | 400 | DECLARE_PEM_write_fp(name, type) |
| 324 | 401 | ||
| 402 | #define DECLARE_PEM_write_const(name, type) \ | ||
| 403 | DECLARE_PEM_write_bio_const(name, type) \ | ||
| 404 | DECLARE_PEM_write_fp_const(name, type) | ||
| 405 | |||
| 325 | #define DECLARE_PEM_write_cb(name, type) \ | 406 | #define DECLARE_PEM_write_cb(name, type) \ |
| 326 | DECLARE_PEM_write_cb_bio(name, type) \ | 407 | DECLARE_PEM_write_cb_bio(name, type) \ |
| 327 | DECLARE_PEM_write_cb_fp(name, type) | 408 | DECLARE_PEM_write_cb_fp(name, type) |
| @@ -334,6 +415,10 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | |||
| 334 | DECLARE_PEM_read(name, type) \ | 415 | DECLARE_PEM_read(name, type) \ |
| 335 | DECLARE_PEM_write(name, type) | 416 | DECLARE_PEM_write(name, type) |
| 336 | 417 | ||
| 418 | #define DECLARE_PEM_rw_const(name, type) \ | ||
| 419 | DECLARE_PEM_read(name, type) \ | ||
| 420 | DECLARE_PEM_write_const(name, type) | ||
| 421 | |||
| 337 | #define DECLARE_PEM_rw_cb(name, type) \ | 422 | #define DECLARE_PEM_rw_cb(name, type) \ |
| 338 | DECLARE_PEM_read(name, type) \ | 423 | DECLARE_PEM_read(name, type) \ |
| 339 | DECLARE_PEM_write_cb(name, type) | 424 | DECLARE_PEM_write_cb(name, type) |
| @@ -403,9 +488,6 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | |||
| 403 | (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\ | 488 | (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\ |
| 404 | (char **)x,cb,u) | 489 | (char **)x,cb,u) |
| 405 | 490 | ||
| 406 | #define PEM_write_bio_SSL_SESSION(bp,x) \ | ||
| 407 | PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \ | ||
| 408 | PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL,NULL) | ||
| 409 | #define PEM_write_bio_X509(bp,x) \ | 491 | #define PEM_write_bio_X509(bp,x) \ |
| 410 | PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \ | 492 | PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \ |
| 411 | (char *)x, NULL,NULL,0,NULL,NULL) | 493 | (char *)x, NULL,NULL,0,NULL,NULL) |
| @@ -444,8 +526,6 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ | |||
| 444 | PEM_STRING_X509,bp, \ | 526 | PEM_STRING_X509,bp, \ |
| 445 | (char *)x, NULL,NULL,0,NULL,NULL) | 527 | (char *)x, NULL,NULL,0,NULL,NULL) |
| 446 | 528 | ||
| 447 | #define PEM_read_bio_SSL_SESSION(bp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read_bio( \ | ||
| 448 | (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb,u) | ||
| 449 | #define PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \ | 529 | #define PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \ |
| 450 | (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u) | 530 | (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u) |
| 451 | #define PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \ | 531 | #define PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \ |
| @@ -494,11 +574,25 @@ int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data, | |||
| 494 | long len); | 574 | long len); |
| 495 | int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp, | 575 | int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp, |
| 496 | pem_password_cb *cb, void *u); | 576 | pem_password_cb *cb, void *u); |
| 497 | char * PEM_ASN1_read_bio(char *(*d2i)(),const char *name,BIO *bp,char **x, | 577 | void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, |
| 498 | pem_password_cb *cb, void *u); | 578 | void **x, pem_password_cb *cb, void *u); |
| 499 | int PEM_ASN1_write_bio(int (*i2d)(),const char *name,BIO *bp,char *x, | 579 | |
| 580 | #define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \ | ||
| 581 | ((type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i), \ | ||
| 582 | name, bp, \ | ||
| 583 | CHECKED_PPTR_OF(type, x), \ | ||
| 584 | cb, u)) | ||
| 585 | |||
| 586 | int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x, | ||
| 500 | const EVP_CIPHER *enc,unsigned char *kstr,int klen, | 587 | const EVP_CIPHER *enc,unsigned char *kstr,int klen, |
| 501 | pem_password_cb *cb, void *u); | 588 | pem_password_cb *cb, void *u); |
| 589 | |||
| 590 | #define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \ | ||
| 591 | (PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d), \ | ||
| 592 | name, bp, \ | ||
| 593 | CHECKED_PTR_OF(type, x), \ | ||
| 594 | enc, kstr, klen, cb, u)) | ||
| 595 | |||
| 502 | STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); | 596 | STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u); |
| 503 | int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, | 597 | int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, |
| 504 | unsigned char *kstr, int klen, pem_password_cb *cd, void *u); | 598 | unsigned char *kstr, int klen, pem_password_cb *cd, void *u); |
| @@ -508,11 +602,11 @@ int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc, | |||
| 508 | int PEM_read(FILE *fp, char **name, char **header, | 602 | int PEM_read(FILE *fp, char **name, char **header, |
| 509 | unsigned char **data,long *len); | 603 | unsigned char **data,long *len); |
| 510 | int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); | 604 | int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len); |
| 511 | char * PEM_ASN1_read(char *(*d2i)(),const char *name,FILE *fp,char **x, | 605 | void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x, |
| 512 | pem_password_cb *cb, void *u); | 606 | pem_password_cb *cb, void *u); |
| 513 | int PEM_ASN1_write(int (*i2d)(),const char *name,FILE *fp,char *x, | 607 | int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp, |
| 514 | const EVP_CIPHER *enc,unsigned char *kstr,int klen, | 608 | char *x,const EVP_CIPHER *enc,unsigned char *kstr, |
| 515 | pem_password_cb *callback, void *u); | 609 | int klen,pem_password_cb *callback, void *u); |
| 516 | STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, | 610 | STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, |
| 517 | pem_password_cb *cb, void *u); | 611 | pem_password_cb *cb, void *u); |
| 518 | #endif | 612 | #endif |
| @@ -542,6 +636,8 @@ DECLARE_PEM_rw(X509, X509) | |||
| 542 | 636 | ||
| 543 | DECLARE_PEM_rw(X509_AUX, X509) | 637 | DECLARE_PEM_rw(X509_AUX, X509) |
| 544 | 638 | ||
| 639 | DECLARE_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR) | ||
| 640 | |||
| 545 | DECLARE_PEM_rw(X509_REQ, X509_REQ) | 641 | DECLARE_PEM_rw(X509_REQ, X509_REQ) |
| 546 | DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) | 642 | DECLARE_PEM_write(X509_REQ_NEW, X509_REQ) |
| 547 | 643 | ||
| @@ -559,7 +655,7 @@ DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) | |||
| 559 | 655 | ||
| 560 | DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) | 656 | DECLARE_PEM_rw_cb(RSAPrivateKey, RSA) |
| 561 | 657 | ||
| 562 | DECLARE_PEM_rw(RSAPublicKey, RSA) | 658 | DECLARE_PEM_rw_const(RSAPublicKey, RSA) |
| 563 | DECLARE_PEM_rw(RSA_PUBKEY, RSA) | 659 | DECLARE_PEM_rw(RSA_PUBKEY, RSA) |
| 564 | 660 | ||
| 565 | #endif | 661 | #endif |
| @@ -570,13 +666,19 @@ DECLARE_PEM_rw_cb(DSAPrivateKey, DSA) | |||
| 570 | 666 | ||
| 571 | DECLARE_PEM_rw(DSA_PUBKEY, DSA) | 667 | DECLARE_PEM_rw(DSA_PUBKEY, DSA) |
| 572 | 668 | ||
| 573 | DECLARE_PEM_rw(DSAparams, DSA) | 669 | DECLARE_PEM_rw_const(DSAparams, DSA) |
| 670 | |||
| 671 | #endif | ||
| 574 | 672 | ||
| 673 | #ifndef OPENSSL_NO_EC | ||
| 674 | DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP) | ||
| 675 | DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY) | ||
| 676 | DECLARE_PEM_rw(EC_PUBKEY, EC_KEY) | ||
| 575 | #endif | 677 | #endif |
| 576 | 678 | ||
| 577 | #ifndef OPENSSL_NO_DH | 679 | #ifndef OPENSSL_NO_DH |
| 578 | 680 | ||
| 579 | DECLARE_PEM_rw(DHparams, DH) | 681 | DECLARE_PEM_rw_const(DHparams, DH) |
| 580 | 682 | ||
| 581 | #endif | 683 | #endif |
| 582 | 684 | ||
| @@ -626,24 +728,27 @@ void ERR_load_PEM_strings(void); | |||
| 626 | /* Function codes. */ | 728 | /* Function codes. */ |
| 627 | #define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 | 729 | #define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120 |
| 628 | #define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 | 730 | #define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121 |
| 629 | #define PEM_F_DEF_CALLBACK 100 | 731 | #define PEM_F_DO_PK8PKEY 126 |
| 732 | #define PEM_F_DO_PK8PKEY_FP 125 | ||
| 630 | #define PEM_F_LOAD_IV 101 | 733 | #define PEM_F_LOAD_IV 101 |
| 631 | #define PEM_F_PEM_ASN1_READ 102 | 734 | #define PEM_F_PEM_ASN1_READ 102 |
| 632 | #define PEM_F_PEM_ASN1_READ_BIO 103 | 735 | #define PEM_F_PEM_ASN1_READ_BIO 103 |
| 633 | #define PEM_F_PEM_ASN1_WRITE 104 | 736 | #define PEM_F_PEM_ASN1_WRITE 104 |
| 634 | #define PEM_F_PEM_ASN1_WRITE_BIO 105 | 737 | #define PEM_F_PEM_ASN1_WRITE_BIO 105 |
| 738 | #define PEM_F_PEM_DEF_CALLBACK 100 | ||
| 635 | #define PEM_F_PEM_DO_HEADER 106 | 739 | #define PEM_F_PEM_DO_HEADER 106 |
| 636 | #define PEM_F_PEM_F_DO_PK8KEY_FP 122 | ||
| 637 | #define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118 | 740 | #define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118 |
| 638 | #define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 | 741 | #define PEM_F_PEM_GET_EVP_CIPHER_INFO 107 |
| 742 | #define PEM_F_PEM_PK8PKEY 119 | ||
| 639 | #define PEM_F_PEM_READ 108 | 743 | #define PEM_F_PEM_READ 108 |
| 640 | #define PEM_F_PEM_READ_BIO 109 | 744 | #define PEM_F_PEM_READ_BIO 109 |
| 745 | #define PEM_F_PEM_READ_BIO_PRIVATEKEY 123 | ||
| 746 | #define PEM_F_PEM_READ_PRIVATEKEY 124 | ||
| 641 | #define PEM_F_PEM_SEALFINAL 110 | 747 | #define PEM_F_PEM_SEALFINAL 110 |
| 642 | #define PEM_F_PEM_SEALINIT 111 | 748 | #define PEM_F_PEM_SEALINIT 111 |
| 643 | #define PEM_F_PEM_SIGNFINAL 112 | 749 | #define PEM_F_PEM_SIGNFINAL 112 |
| 644 | #define PEM_F_PEM_WRITE 113 | 750 | #define PEM_F_PEM_WRITE 113 |
| 645 | #define PEM_F_PEM_WRITE_BIO 114 | 751 | #define PEM_F_PEM_WRITE_BIO 114 |
| 646 | #define PEM_F_PEM_WRITE_BIO_PKCS8PRIVATEKEY 119 | ||
| 647 | #define PEM_F_PEM_X509_INFO_READ 115 | 752 | #define PEM_F_PEM_X509_INFO_READ 115 |
| 648 | #define PEM_F_PEM_X509_INFO_READ_BIO 116 | 753 | #define PEM_F_PEM_X509_INFO_READ_BIO 116 |
| 649 | #define PEM_F_PEM_X509_INFO_WRITE_BIO 117 | 754 | #define PEM_F_PEM_X509_INFO_WRITE_BIO 117 |
