1# This file is dual licensed under the terms of the Apache License, Version
2# 2.0, and the BSD License. See the LICENSE file in the root of this repository
3# for complete details.
4
5from __future__ import absolute_import, division, print_function
6
7INCLUDES = """
8#include <openssl/pem.h>
9"""
10
11TYPES = """
12typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata);
13"""
14
15FUNCTIONS = """
16X509 *PEM_read_bio_X509(BIO *, X509 **, pem_password_cb *, void *);
17int PEM_write_bio_X509(BIO *, X509 *);
18
19int PEM_write_bio_PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,
20                             unsigned char *, int, pem_password_cb *, void *);
21
22EVP_PKEY *PEM_read_bio_PrivateKey(BIO *, EVP_PKEY **, pem_password_cb *,
23                                 void *);
24
25int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,
26                                  char *, int, pem_password_cb *, void *);
27int PEM_write_bio_PKCS8PrivateKey_nid(BIO *, EVP_PKEY *, int, char *, int,
28                                      pem_password_cb *, void *);
29
30int i2d_PKCS8PrivateKey_bio(BIO *, EVP_PKEY *, const EVP_CIPHER *,
31                            char *, int, pem_password_cb *, void *);
32int i2d_PKCS8PrivateKey_nid_bio(BIO *, EVP_PKEY *, int,
33                                char *, int, pem_password_cb *, void *);
34
35int i2d_PKCS7_bio(BIO *, PKCS7 *);
36PKCS7 *d2i_PKCS7_bio(BIO *, PKCS7 **);
37
38EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *, EVP_PKEY **, pem_password_cb *,
39                                  void *);
40
41int PEM_write_bio_X509_REQ(BIO *, X509_REQ *);
42
43X509_REQ *PEM_read_bio_X509_REQ(BIO *, X509_REQ **, pem_password_cb *, void *);
44
45X509_CRL *PEM_read_bio_X509_CRL(BIO *, X509_CRL **, pem_password_cb *, void *);
46
47int PEM_write_bio_X509_CRL(BIO *, X509_CRL *);
48
49X509 *PEM_read_bio_X509_AUX(BIO *, X509 **, pem_password_cb *, void *);
50
51PKCS7 *PEM_read_bio_PKCS7(BIO *, PKCS7 **, pem_password_cb *, void *);
52int PEM_write_bio_PKCS7(BIO *, PKCS7 *);
53
54DH *PEM_read_bio_DHparams(BIO *, DH **, pem_password_cb *, void *);
55
56DSA *PEM_read_bio_DSAPrivateKey(BIO *, DSA **, pem_password_cb *, void *);
57
58RSA *PEM_read_bio_RSAPrivateKey(BIO *, RSA **, pem_password_cb *, void *);
59
60int PEM_write_bio_DSAPrivateKey(BIO *, DSA *, const EVP_CIPHER *,
61                                unsigned char *, int,
62                                pem_password_cb *, void *);
63
64int PEM_write_bio_RSAPrivateKey(BIO *, RSA *, const EVP_CIPHER *,
65                                unsigned char *, int,
66                                pem_password_cb *, void *);
67
68DSA *PEM_read_bio_DSA_PUBKEY(BIO *, DSA **, pem_password_cb *, void *);
69
70RSA *PEM_read_bio_RSAPublicKey(BIO *, RSA **, pem_password_cb *, void *);
71
72int PEM_write_bio_DSA_PUBKEY(BIO *, DSA *);
73
74int PEM_write_bio_RSAPublicKey(BIO *, const RSA *);
75
76EVP_PKEY *PEM_read_bio_PUBKEY(BIO *, EVP_PKEY **, pem_password_cb *, void *);
77int PEM_write_bio_PUBKEY(BIO *, EVP_PKEY *);
78int PEM_write_bio_ECPrivateKey(BIO *, EC_KEY *, const EVP_CIPHER *,
79                               unsigned char *, int, pem_password_cb *,
80                               void *);
81int PEM_write_bio_DHparams(BIO *, DH *);
82int PEM_write_bio_DHxparams(BIO *, DH *);
83"""
84
85CUSTOMIZATIONS = """
86#if !defined(EVP_PKEY_DHX) || EVP_PKEY_DHX == -1
87int (*PEM_write_bio_DHxparams)(BIO *, DH *) = NULL;
88#endif
89"""
90