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