| 1 | use super::super::*; |
| 2 | use libc::*; |
| 3 | |
| 4 | pub type pem_password_cb = Option< |
| 5 | unsafe extern "C" fn( |
| 6 | buf: *mut c_char, |
| 7 | size: c_int, |
| 8 | rwflag: c_int, |
| 9 | user_data: *mut c_void, |
| 10 | ) -> c_int, |
| 11 | >; |
| 12 | |
| 13 | const_ptr_api! { |
| 14 | extern "C" { |
| 15 | pub fn PEM_write_bio_X509(bio: *mut BIO, x509: #[const_ptr_if(ossl300)] X509) -> c_int; |
| 16 | pub fn PEM_write_bio_X509_REQ(bio: *mut BIO, x509: #[const_ptr_if(ossl300)] X509_REQ) -> c_int; |
| 17 | pub fn PEM_write_bio_X509_CRL(bio: *mut BIO, x509: #[const_ptr_if(ossl300)] X509_CRL) -> c_int; |
| 18 | pub fn PEM_write_bio_RSAPrivateKey( |
| 19 | bp: *mut BIO, |
| 20 | rsa: #[const_ptr_if(ossl300)] RSA, |
| 21 | cipher: *const EVP_CIPHER, |
| 22 | kstr: #[const_ptr_if(ossl300)] c_uchar, |
| 23 | klen: c_int, |
| 24 | callback: pem_password_cb, |
| 25 | user_data: *mut c_void, |
| 26 | ) -> c_int; |
| 27 | pub fn PEM_write_bio_RSA_PUBKEY(bp: *mut BIO, rsa: #[const_ptr_if(ossl300)] RSA) -> c_int; |
| 28 | pub fn PEM_write_bio_DSAPrivateKey( |
| 29 | bp: *mut BIO, |
| 30 | dsa: #[const_ptr_if(ossl300)] DSA, |
| 31 | cipher: *const EVP_CIPHER, |
| 32 | kstr: #[const_ptr_if(ossl300)] c_uchar, |
| 33 | klen: c_int, |
| 34 | callback: pem_password_cb, |
| 35 | user_data: *mut c_void, |
| 36 | ) -> c_int; |
| 37 | pub fn PEM_write_bio_ECPrivateKey( |
| 38 | bio: *mut BIO, |
| 39 | key: #[const_ptr_if(ossl300)] EC_KEY, |
| 40 | cipher: *const EVP_CIPHER, |
| 41 | kstr: #[const_ptr_if(ossl300)] c_uchar, |
| 42 | klen: c_int, |
| 43 | callback: pem_password_cb, |
| 44 | user_data: *mut c_void, |
| 45 | ) -> c_int; |
| 46 | pub fn PEM_write_bio_DSA_PUBKEY(bp: *mut BIO, dsa: #[const_ptr_if(ossl300)] DSA) -> c_int; |
| 47 | pub fn PEM_write_bio_PrivateKey( |
| 48 | bio: *mut BIO, |
| 49 | pkey: #[const_ptr_if(ossl300)] EVP_PKEY, |
| 50 | cipher: *const EVP_CIPHER, |
| 51 | kstr: #[const_ptr_if(ossl300)] c_uchar, |
| 52 | klen: c_int, |
| 53 | callback: pem_password_cb, |
| 54 | user_data: *mut c_void, |
| 55 | ) -> c_int; |
| 56 | pub fn PEM_write_bio_PUBKEY(bp: *mut BIO, x: #[const_ptr_if(ossl300)] EVP_PKEY) -> c_int; |
| 57 | pub fn PEM_write_bio_PKCS8PrivateKey( |
| 58 | bio: *mut BIO, |
| 59 | pkey: #[const_ptr_if(ossl300)] EVP_PKEY, |
| 60 | cipher: *const EVP_CIPHER, |
| 61 | kstr: #[const_ptr_if(ossl300)] c_char, |
| 62 | klen: c_int, |
| 63 | callback: pem_password_cb, |
| 64 | user_data: *mut c_void, |
| 65 | ) -> c_int; |
| 66 | pub fn PEM_write_bio_PKCS7(bp: *mut BIO, x: #[const_ptr_if(ossl300)] PKCS7) -> c_int; |
| 67 | pub fn PEM_write_bio_EC_PUBKEY(bp: *mut BIO, ec: #[const_ptr_if(ossl300)] EC_KEY) -> c_int; |
| 68 | pub fn i2d_PKCS8PrivateKey_bio( |
| 69 | bp: *mut BIO, |
| 70 | x: #[const_ptr_if(ossl300)] EVP_PKEY, |
| 71 | enc: *const EVP_CIPHER, |
| 72 | kstr: #[const_ptr_if(ossl300)] c_char, |
| 73 | klen: c_int, |
| 74 | cb: pem_password_cb, |
| 75 | u: *mut c_void, |
| 76 | ) -> c_int; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | unsafeextern "C" { |
| 81 | pub unsafefn PEM_read_bio_X509( |
| 82 | bio: *mut BIO, |
| 83 | out: *mut *mut X509, |
| 84 | callback: pem_password_cb, |
| 85 | user_data: *mut c_void, |
| 86 | ) -> *mut X509; |
| 87 | pub unsafefn PEM_read_bio_X509_REQ( |
| 88 | bio: *mut BIO, |
| 89 | out: *mut *mut X509_REQ, |
| 90 | callback: pem_password_cb, |
| 91 | user_data: *mut c_void, |
| 92 | ) -> *mut X509_REQ; |
| 93 | pub unsafefn PEM_read_bio_X509_CRL( |
| 94 | bio: *mut BIO, |
| 95 | out: *mut *mut X509_CRL, |
| 96 | callback: pem_password_cb, |
| 97 | user_data: *mut c_void, |
| 98 | ) -> *mut X509_CRL; |
| 99 | pub unsafefn PEM_read_bio_RSAPrivateKey( |
| 100 | bio: *mut BIO, |
| 101 | rsa: *mut *mut RSA, |
| 102 | callback: pem_password_cb, |
| 103 | user_data: *mut c_void, |
| 104 | ) -> *mut RSA; |
| 105 | pub unsafefn PEM_read_bio_RSAPublicKey( |
| 106 | bio: *mut BIO, |
| 107 | rsa: *mut *mut RSA, |
| 108 | callback: pem_password_cb, |
| 109 | user_data: *mut c_void, |
| 110 | ) -> *mut RSA; |
| 111 | pub unsafefn PEM_write_bio_RSAPublicKey(bp: *mut BIO, rsa: *const RSA) -> c_int; |
| 112 | pub unsafefn PEM_read_bio_RSA_PUBKEY( |
| 113 | bio: *mut BIO, |
| 114 | rsa: *mut *mut RSA, |
| 115 | callback: pem_password_cb, |
| 116 | user_data: *mut c_void, |
| 117 | ) -> *mut RSA; |
| 118 | pub unsafefn PEM_read_bio_DSAPrivateKey( |
| 119 | bp: *mut BIO, |
| 120 | dsa: *mut *mut DSA, |
| 121 | callback: pem_password_cb, |
| 122 | user_data: *mut c_void, |
| 123 | ) -> *mut DSA; |
| 124 | pub unsafefn PEM_read_bio_DSA_PUBKEY( |
| 125 | bp: *mut BIO, |
| 126 | dsa: *mut *mut DSA, |
| 127 | callback: pem_password_cb, |
| 128 | user_data: *mut c_void, |
| 129 | ) -> *mut DSA; |
| 130 | pub unsafefn PEM_read_bio_ECPrivateKey( |
| 131 | bio: *mut BIO, |
| 132 | key: *mut *mut EC_KEY, |
| 133 | callback: pem_password_cb, |
| 134 | user_data: *mut c_void, |
| 135 | ) -> *mut EC_KEY; |
| 136 | pub unsafefn PEM_read_bio_EC_PUBKEY( |
| 137 | bp: *mut BIO, |
| 138 | ec: *mut *mut EC_KEY, |
| 139 | callback: pem_password_cb, |
| 140 | user_data: *mut c_void, |
| 141 | ) -> *mut EC_KEY; |
| 142 | pub unsafefn PEM_read_bio_DHparams( |
| 143 | bio: *mut BIO, |
| 144 | out: *mut *mut DH, |
| 145 | callback: pem_password_cb, |
| 146 | user_data: *mut c_void, |
| 147 | ) -> *mut DH; |
| 148 | pub unsafefn PEM_write_bio_DHparams(bio: *mut BIO, x: *const DH) -> c_int; |
| 149 | pub unsafefn PEM_read_bio_PrivateKey( |
| 150 | bio: *mut BIO, |
| 151 | out: *mut *mut EVP_PKEY, |
| 152 | callback: pem_password_cb, |
| 153 | user_data: *mut c_void, |
| 154 | ) -> *mut EVP_PKEY; |
| 155 | pub unsafefn PEM_read_bio_PUBKEY( |
| 156 | bio: *mut BIO, |
| 157 | out: *mut *mut EVP_PKEY, |
| 158 | callback: pem_password_cb, |
| 159 | user_data: *mut c_void, |
| 160 | ) -> *mut EVP_PKEY; |
| 161 | |
| 162 | pub unsafefn d2i_PKCS8PrivateKey_bio( |
| 163 | bp: *mut BIO, |
| 164 | x: *mut *mut EVP_PKEY, |
| 165 | cb: pem_password_cb, |
| 166 | u: *mut c_void, |
| 167 | ) -> *mut EVP_PKEY; |
| 168 | pub unsafefn d2i_PKCS8_PRIV_KEY_INFO( |
| 169 | k: *mut *mut PKCS8_PRIV_KEY_INFO, |
| 170 | buf: *mut *const u8, |
| 171 | length: c_long, |
| 172 | ) -> *mut PKCS8_PRIV_KEY_INFO; |
| 173 | pub unsafefn PKCS8_PRIV_KEY_INFO_free(p8inf: *mut PKCS8_PRIV_KEY_INFO); |
| 174 | |
| 175 | pub unsafefn PEM_read_bio_PKCS7( |
| 176 | bio: *mut BIO, |
| 177 | out: *mut *mut PKCS7, |
| 178 | cb: pem_password_cb, |
| 179 | u: *mut c_void, |
| 180 | ) -> *mut PKCS7; |
| 181 | |
| 182 | #[cfg (ossl101)] |
| 183 | pub unsafefn PEM_read_bio_CMS( |
| 184 | bio: *mut BIO, |
| 185 | out: *mut *mut CMS_ContentInfo, |
| 186 | callback: pem_password_cb, |
| 187 | user_data: *mut c_void, |
| 188 | ) -> *mut CMS_ContentInfo; |
| 189 | #[cfg (ossl101)] |
| 190 | pub unsafefn PEM_write_bio_CMS(bio: *mut BIO, cms: *const CMS_ContentInfo) -> c_int; |
| 191 | } |
| 192 | |