1 use libc::*; 2 3 use *; 4 5 pub const X509_FILETYPE_PEM: c_int = 1; 6 pub const X509_FILETYPE_ASN1: c_int = 2; 7 pub const X509_FILETYPE_DEFAULT: c_int = 3; 8 9 pub const ASN1_R_HEADER_TOO_LONG: c_int = 123; 10 11 #[repr(C)] 12 pub struct X509_VAL { 13 pub notBefore: *mut ASN1_TIME, 14 pub notAfter: *mut ASN1_TIME, 15 } 16 17 pub enum X509_NAME_ENTRY {} 18 19 stack!(stack_st_X509_NAME); 20 21 pub enum X509_EXTENSION {} 22 23 stack!(stack_st_X509_EXTENSION); 24 25 stack!(stack_st_X509_ATTRIBUTE); 26 27 cfg_if! { 28 if #[cfg(ossl110)] { 29 pub enum X509_REQ_INFO {} 30 } else { 31 #[repr(C)] 32 pub struct X509_REQ_INFO { 33 pub enc: ASN1_ENCODING, 34 pub version: *mut ::ASN1_INTEGER, 35 pub subject: *mut ::X509_NAME, 36 pubkey: *mut c_void, 37 pub attributes: *mut stack_st_X509_ATTRIBUTE, 38 } 39 } 40 } 41 42 cfg_if! { 43 if #[cfg(ossl110)] { 44 pub enum X509_CRL {} 45 } else { 46 #[repr(C)] 47 pub struct X509_CRL { 48 pub crl: *mut X509_CRL_INFO, 49 sig_alg: *mut X509_ALGOR, 50 signature: *mut c_void, 51 references: c_int, 52 flags: c_int, 53 akid: *mut c_void, 54 idp: *mut c_void, 55 idp_flags: c_int, 56 idp_reasons: c_int, 57 crl_number: *mut ASN1_INTEGER, 58 base_crl_number: *mut ASN1_INTEGER, 59 sha1_hash: [c_uchar; 20], 60 issuers: *mut c_void, 61 meth: *const c_void, 62 meth_data: *mut c_void, 63 } 64 } 65 } 66 67 stack!(stack_st_X509_CRL); 68 69 cfg_if! { 70 if #[cfg(ossl110)] { 71 pub enum X509_CRL_INFO {} 72 } else { 73 #[repr(C)] 74 pub struct X509_CRL_INFO { 75 version: *mut ASN1_INTEGER, 76 sig_alg: *mut X509_ALGOR, 77 pub issuer: *mut X509_NAME, 78 pub lastUpdate: *mut ASN1_TIME, 79 pub nextUpdate: *mut ASN1_TIME, 80 pub revoked: *mut stack_st_X509_REVOKED, 81 extensions: *mut stack_st_X509_EXTENSION, 82 enc: ASN1_ENCODING, 83 } 84 } 85 } 86 87 cfg_if! { 88 if #[cfg(ossl110)] { 89 pub enum X509_REVOKED {} 90 } else { 91 #[repr(C)] 92 pub struct X509_REVOKED { 93 pub serialNumber: *mut ASN1_INTEGER, 94 pub revocationDate: *mut ASN1_TIME, 95 pub extensions: *mut stack_st_X509_EXTENSION, 96 issuer: *mut stack_st_GENERAL_NAME, 97 reason: c_int, 98 sequence: c_int, 99 } 100 } 101 } 102 103 stack!(stack_st_X509_REVOKED); 104 105 cfg_if! { 106 if #[cfg(ossl110)] { 107 pub enum X509_REQ {} 108 } else { 109 #[repr(C)] 110 pub struct X509_REQ { 111 pub req_info: *mut X509_REQ_INFO, 112 sig_alg: *mut c_void, 113 signature: *mut c_void, 114 references: c_int, 115 } 116 } 117 } 118 119 cfg_if! { 120 if #[cfg(ossl110)] { 121 pub enum X509_CINF {} 122 } else { 123 #[repr(C)] 124 pub struct X509_CINF { 125 version: *mut c_void, 126 serialNumber: *mut c_void, 127 signature: *mut c_void, 128 issuer: *mut c_void, 129 pub validity: *mut X509_VAL, 130 subject: *mut c_void, 131 key: *mut c_void, 132 issuerUID: *mut c_void, 133 subjectUID: *mut c_void, 134 pub extensions: *mut stack_st_X509_EXTENSION, 135 enc: ASN1_ENCODING, 136 } 137 } 138 } 139 140 stack!(stack_st_X509); 141 142 cfg_if! { 143 if #[cfg(not(ossl110))] { 144 pub const X509_LU_FAIL: c_int = 0; 145 pub const X509_LU_X509: c_int = 1; 146 pub const X509_LU_CRL: c_int = 2; 147 } 148 } 149 150 cfg_if! { 151 if #[cfg(any(ossl110, libressl270))] { 152 pub enum X509_OBJECT {} 153 } else { 154 #[repr(C)] 155 pub struct X509_OBJECT { 156 pub type_: c_int, 157 pub data: X509_OBJECT_data, 158 } 159 #[repr(C)] 160 pub union X509_OBJECT_data { 161 pub ptr: *mut c_char, 162 pub x509: *mut X509, 163 pub crl: *mut X509_CRL, 164 pub pkey: *mut EVP_PKEY, 165 } 166 } 167 } 168 169 stack!(stack_st_X509_OBJECT); 170 171 pub enum X509_LOOKUP {} 172 173 stack!(stack_st_X509_LOOKUP); 174 175 extern "C" { X509_verify_cert_error_string(n: c_long) -> *const c_char176 pub fn X509_verify_cert_error_string(n: c_long) -> *const c_char; 177 X509_sign(x: *mut X509, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> c_int178 pub fn X509_sign(x: *mut X509, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> c_int; 179 X509_digest( x: *const X509, digest: *const EVP_MD, buf: *mut c_uchar, len: *mut c_uint, ) -> c_int180 pub fn X509_digest( 181 x: *const X509, 182 digest: *const EVP_MD, 183 buf: *mut c_uchar, 184 len: *mut c_uint, 185 ) -> c_int; 186 X509_REQ_sign(x: *mut X509_REQ, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> c_int187 pub fn X509_REQ_sign(x: *mut X509_REQ, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> c_int; 188 } 189 190 const_ptr_api! { 191 extern "C" { 192 pub fn i2d_X509_bio(b: *mut BIO, x: #[const_ptr_if(ossl300)] X509) -> c_int; 193 pub fn i2d_X509_REQ_bio(b: *mut BIO, x: #[const_ptr_if(ossl300)] X509_REQ) -> c_int; 194 pub fn i2d_PrivateKey_bio(b: *mut BIO, x: #[const_ptr_if(ossl300)] EVP_PKEY) -> c_int; 195 pub fn i2d_PUBKEY_bio(b: *mut BIO, x: #[const_ptr_if(ossl300)] EVP_PKEY) -> c_int; 196 197 pub fn i2d_PUBKEY(k: #[const_ptr_if(ossl300)] EVP_PKEY, buf: *mut *mut u8) -> c_int; 198 pub fn i2d_RSA_PUBKEY(k: #[const_ptr_if(ossl300)] RSA, buf: *mut *mut u8) -> c_int; 199 pub fn i2d_DSA_PUBKEY(a: #[const_ptr_if(ossl300)] DSA, pp: *mut *mut c_uchar) -> c_int; 200 pub fn i2d_PrivateKey(k: #[const_ptr_if(ossl300)] EVP_PKEY, buf: *mut *mut u8) -> c_int; 201 pub fn i2d_ECPrivateKey(ec_key: #[const_ptr_if(ossl300)] EC_KEY, pp: *mut *mut c_uchar) -> c_int; 202 pub fn i2d_EC_PUBKEY(a: #[const_ptr_if(ossl300)] EC_KEY, pp: *mut *mut c_uchar) -> c_int; 203 } 204 } 205 extern "C" { d2i_PUBKEY(k: *mut *mut EVP_PKEY, buf: *mut *const u8, len: c_long) -> *mut EVP_PKEY206 pub fn d2i_PUBKEY(k: *mut *mut EVP_PKEY, buf: *mut *const u8, len: c_long) -> *mut EVP_PKEY; d2i_RSA_PUBKEY(k: *mut *mut RSA, buf: *mut *const u8, len: c_long) -> *mut RSA207 pub fn d2i_RSA_PUBKEY(k: *mut *mut RSA, buf: *mut *const u8, len: c_long) -> *mut RSA; d2i_DSA_PUBKEY(k: *mut *mut DSA, pp: *mut *const c_uchar, length: c_long) -> *mut DSA208 pub fn d2i_DSA_PUBKEY(k: *mut *mut DSA, pp: *mut *const c_uchar, length: c_long) -> *mut DSA; d2i_EC_PUBKEY( a: *mut *mut EC_KEY, pp: *mut *const c_uchar, length: c_long, ) -> *mut EC_KEY209 pub fn d2i_EC_PUBKEY( 210 a: *mut *mut EC_KEY, 211 pp: *mut *const c_uchar, 212 length: c_long, 213 ) -> *mut EC_KEY; 214 d2i_ECPrivateKey( k: *mut *mut EC_KEY, pp: *mut *const c_uchar, length: c_long, ) -> *mut EC_KEY215 pub fn d2i_ECPrivateKey( 216 k: *mut *mut EC_KEY, 217 pp: *mut *const c_uchar, 218 length: c_long, 219 ) -> *mut EC_KEY; 220 } 221 222 const_ptr_api! { 223 extern "C" { 224 #[cfg(ossl102)] 225 pub fn X509_ALGOR_get0( 226 paobj: *mut #[const_ptr_if(ossl110)] ASN1_OBJECT, 227 pptype: *mut c_int, 228 ppval: *mut #[const_ptr_if(ossl110)] c_void, 229 alg: #[const_ptr_if(ossl110)] X509_ALGOR, 230 ); 231 } 232 } 233 234 extern "C" { X509_gmtime_adj(time: *mut ASN1_TIME, adj: c_long) -> *mut ASN1_TIME235 pub fn X509_gmtime_adj(time: *mut ASN1_TIME, adj: c_long) -> *mut ASN1_TIME; 236 X509_to_X509_REQ(x: *mut X509, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> *mut X509_REQ237 pub fn X509_to_X509_REQ(x: *mut X509, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> *mut X509_REQ; 238 X509_ALGOR_free(x: *mut X509_ALGOR)239 pub fn X509_ALGOR_free(x: *mut X509_ALGOR); 240 X509_REVOKED_new() -> *mut X509_REVOKED241 pub fn X509_REVOKED_new() -> *mut X509_REVOKED; X509_REVOKED_free(x: *mut X509_REVOKED)242 pub fn X509_REVOKED_free(x: *mut X509_REVOKED); 243 } 244 const_ptr_api! { 245 extern "C" { 246 #[cfg(any(ossl110, libressl270))] 247 pub fn X509_REVOKED_dup(rev: #[const_ptr_if(ossl300)] X509_REVOKED) -> *mut X509_REVOKED; 248 } 249 } 250 251 extern "C" { d2i_X509_REVOKED( a: *mut *mut X509_REVOKED, pp: *mut *const c_uchar, length: c_long, ) -> *mut X509_REVOKED252 pub fn d2i_X509_REVOKED( 253 a: *mut *mut X509_REVOKED, 254 pp: *mut *const c_uchar, 255 length: c_long, 256 ) -> *mut X509_REVOKED; 257 } 258 const_ptr_api! { 259 extern "C" { 260 pub fn i2d_X509_REVOKED(x: #[const_ptr_if(ossl300)] X509_REVOKED, buf: *mut *mut u8) -> c_int; 261 } 262 } 263 extern "C" { X509_CRL_new() -> *mut X509_CRL264 pub fn X509_CRL_new() -> *mut X509_CRL; X509_CRL_free(x: *mut X509_CRL)265 pub fn X509_CRL_free(x: *mut X509_CRL); d2i_X509_CRL( a: *mut *mut X509_CRL, pp: *mut *const c_uchar, length: c_long, ) -> *mut X509_CRL266 pub fn d2i_X509_CRL( 267 a: *mut *mut X509_CRL, 268 pp: *mut *const c_uchar, 269 length: c_long, 270 ) -> *mut X509_CRL; 271 } 272 const_ptr_api! { 273 extern "C" { 274 pub fn i2d_X509_CRL(x: #[const_ptr_if(ossl300)] X509_CRL, buf: *mut *mut u8) -> c_int; 275 } 276 } 277 278 extern "C" { X509_REQ_new() -> *mut X509_REQ279 pub fn X509_REQ_new() -> *mut X509_REQ; X509_REQ_free(x: *mut X509_REQ)280 pub fn X509_REQ_free(x: *mut X509_REQ); d2i_X509_REQ( a: *mut *mut X509_REQ, pp: *mut *const c_uchar, length: c_long, ) -> *mut X509_REQ281 pub fn d2i_X509_REQ( 282 a: *mut *mut X509_REQ, 283 pp: *mut *const c_uchar, 284 length: c_long, 285 ) -> *mut X509_REQ; 286 } 287 const_ptr_api! { 288 extern "C" { 289 pub fn i2d_X509_REQ(x: #[const_ptr_if(ossl300)] X509_REQ, buf: *mut *mut u8) -> c_int; 290 291 #[cfg(any(ossl102, libressl273))] 292 pub fn X509_get0_signature( 293 psig: *mut #[const_ptr_if(any(ossl110, libressl273))] ASN1_BIT_STRING, 294 palg: *mut #[const_ptr_if(any(ossl110, libressl273))] X509_ALGOR, 295 x: *const X509, 296 ); 297 } 298 } 299 extern "C" { 300 #[cfg(ossl102)] X509_get_signature_nid(x: *const X509) -> c_int301 pub fn X509_get_signature_nid(x: *const X509) -> c_int; 302 X509_EXTENSION_free(ext: *mut X509_EXTENSION)303 pub fn X509_EXTENSION_free(ext: *mut X509_EXTENSION); 304 X509_NAME_ENTRY_free(x: *mut X509_NAME_ENTRY)305 pub fn X509_NAME_ENTRY_free(x: *mut X509_NAME_ENTRY); 306 X509_NAME_new() -> *mut X509_NAME307 pub fn X509_NAME_new() -> *mut X509_NAME; X509_NAME_free(x: *mut X509_NAME)308 pub fn X509_NAME_free(x: *mut X509_NAME); 309 X509_new() -> *mut X509310 pub fn X509_new() -> *mut X509; X509_free(x: *mut X509)311 pub fn X509_free(x: *mut X509); 312 } 313 const_ptr_api! { 314 extern "C" { 315 pub fn i2d_X509(x: #[const_ptr_if(ossl300)] X509, buf: *mut *mut u8) -> c_int; 316 } 317 } 318 extern "C" { d2i_X509(a: *mut *mut X509, pp: *mut *const c_uchar, length: c_long) -> *mut X509319 pub fn d2i_X509(a: *mut *mut X509, pp: *mut *const c_uchar, length: c_long) -> *mut X509; d2i_X509_bio(b: *mut BIO, a: *mut *mut X509) -> *mut X509320 pub fn d2i_X509_bio(b: *mut BIO, a: *mut *mut X509) -> *mut X509; 321 X509_get_pubkey(x: *mut X509) -> *mut EVP_PKEY322 pub fn X509_get_pubkey(x: *mut X509) -> *mut EVP_PKEY; 323 X509_set_version(x: *mut X509, version: c_long) -> c_int324 pub fn X509_set_version(x: *mut X509, version: c_long) -> c_int; 325 #[cfg(ossl110)] X509_get_version(x: *const X509) -> c_long326 pub fn X509_get_version(x: *const X509) -> c_long; X509_set_serialNumber(x: *mut X509, sn: *mut ASN1_INTEGER) -> c_int327 pub fn X509_set_serialNumber(x: *mut X509, sn: *mut ASN1_INTEGER) -> c_int; X509_get_serialNumber(x: *mut X509) -> *mut ASN1_INTEGER328 pub fn X509_get_serialNumber(x: *mut X509) -> *mut ASN1_INTEGER; 329 } 330 const_ptr_api! { 331 extern "C" { 332 pub fn X509_set_issuer_name(x: *mut X509, name: #[const_ptr_if(ossl300)] X509_NAME) -> c_int; 333 } 334 } 335 extern "C" { X509_subject_name_hash(x: *mut ::X509) -> c_ulong336 pub fn X509_subject_name_hash(x: *mut ::X509) -> c_ulong; 337 } 338 const_ptr_api! { 339 extern "C" { 340 pub fn X509_get_issuer_name(x: #[const_ptr_if(any(ossl110, libressl280))] ::X509) -> *mut ::X509_NAME; 341 pub fn X509_set_subject_name(x: *mut X509, name: #[const_ptr_if(ossl300)] X509_NAME) -> c_int; 342 pub fn X509_get_subject_name(x: #[const_ptr_if(any(ossl110, libressl280))] ::X509) -> *mut ::X509_NAME; 343 } 344 } 345 cfg_if! { 346 if #[cfg(ossl110)] { 347 extern "C" { 348 pub fn X509_set1_notBefore(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int; 349 pub fn X509_set1_notAfter(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int; 350 } 351 } else { 352 extern "C" { 353 pub fn X509_set_notBefore(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int; 354 pub fn X509_set_notAfter(x: *mut ::X509, tm: *const ::ASN1_TIME) -> c_int; 355 } 356 } 357 } 358 extern "C" { 359 #[cfg(ossl110)] X509_REQ_get_version(req: *const X509_REQ) -> c_long360 pub fn X509_REQ_get_version(req: *const X509_REQ) -> c_long; X509_REQ_set_version(req: *mut X509_REQ, version: c_long) -> c_int361 pub fn X509_REQ_set_version(req: *mut X509_REQ, version: c_long) -> c_int; 362 #[cfg(ossl110)] X509_REQ_get_subject_name(req: *const X509_REQ) -> *mut X509_NAME363 pub fn X509_REQ_get_subject_name(req: *const X509_REQ) -> *mut X509_NAME; 364 } 365 const_ptr_api! { 366 extern "C" { 367 pub fn X509_REQ_set_subject_name(req: *mut X509_REQ, name: #[const_ptr_if(ossl300)] X509_NAME) -> c_int; 368 } 369 } 370 extern "C" { X509_REQ_set_pubkey(req: *mut X509_REQ, pkey: *mut EVP_PKEY) -> c_int371 pub fn X509_REQ_set_pubkey(req: *mut X509_REQ, pkey: *mut EVP_PKEY) -> c_int; X509_REQ_get_pubkey(req: *mut X509_REQ) -> *mut EVP_PKEY372 pub fn X509_REQ_get_pubkey(req: *mut X509_REQ) -> *mut EVP_PKEY; X509_REQ_get_extensions(req: *mut X509_REQ) -> *mut stack_st_X509_EXTENSION373 pub fn X509_REQ_get_extensions(req: *mut X509_REQ) -> *mut stack_st_X509_EXTENSION; 374 } 375 const_ptr_api! { 376 extern "C" { 377 pub fn X509_REQ_add_extensions(req: *mut X509_REQ, exts: #[const_ptr_if(ossl300)] stack_st_X509_EXTENSION) 378 -> c_int; 379 } 380 } 381 extern "C" { X509_set_pubkey(x: *mut X509, pkey: *mut EVP_PKEY) -> c_int382 pub fn X509_set_pubkey(x: *mut X509, pkey: *mut EVP_PKEY) -> c_int; X509_REQ_verify(req: *mut X509_REQ, pkey: *mut EVP_PKEY) -> c_int383 pub fn X509_REQ_verify(req: *mut X509_REQ, pkey: *mut EVP_PKEY) -> c_int; 384 #[cfg(any(ossl110, libressl273))] X509_getm_notBefore(x: *const X509) -> *mut ASN1_TIME385 pub fn X509_getm_notBefore(x: *const X509) -> *mut ASN1_TIME; 386 #[cfg(any(ossl110, libressl273))] X509_getm_notAfter(x: *const X509) -> *mut ASN1_TIME387 pub fn X509_getm_notAfter(x: *const X509) -> *mut ASN1_TIME; 388 #[cfg(any(ossl110, libressl273))] X509_up_ref(x: *mut X509) -> c_int389 pub fn X509_up_ref(x: *mut X509) -> c_int; 390 391 #[cfg(any(ossl110, libressl270))] X509_REVOKED_get0_serialNumber(req: *const X509_REVOKED) -> *const ASN1_INTEGER392 pub fn X509_REVOKED_get0_serialNumber(req: *const X509_REVOKED) -> *const ASN1_INTEGER; 393 #[cfg(any(ossl110, libressl270))] X509_REVOKED_get0_revocationDate(req: *const X509_REVOKED) -> *const ASN1_TIME394 pub fn X509_REVOKED_get0_revocationDate(req: *const X509_REVOKED) -> *const ASN1_TIME; 395 #[cfg(any(ossl110, libressl270))] X509_REVOKED_get0_extensions(r: *const X509_REVOKED) -> *const stack_st_X509_EXTENSION396 pub fn X509_REVOKED_get0_extensions(r: *const X509_REVOKED) -> *const stack_st_X509_EXTENSION; 397 X509_REVOKED_set_serialNumber(r: *mut X509_REVOKED, serial: *mut ASN1_INTEGER) -> c_int398 pub fn X509_REVOKED_set_serialNumber(r: *mut X509_REVOKED, serial: *mut ASN1_INTEGER) -> c_int; X509_REVOKED_set_revocationDate(r: *mut X509_REVOKED, tm: *mut ASN1_TIME) -> c_int399 pub fn X509_REVOKED_set_revocationDate(r: *mut X509_REVOKED, tm: *mut ASN1_TIME) -> c_int; 400 X509_CRL_sign(x: *mut X509_CRL, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> c_int401 pub fn X509_CRL_sign(x: *mut X509_CRL, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> c_int; X509_CRL_digest( x: *const X509_CRL, digest: *const EVP_MD, md: *mut c_uchar, len: *mut c_uint, ) -> c_int402 pub fn X509_CRL_digest( 403 x: *const X509_CRL, 404 digest: *const EVP_MD, 405 md: *mut c_uchar, 406 len: *mut c_uint, 407 ) -> c_int; X509_CRL_verify(crl: *mut X509_CRL, pkey: *mut EVP_PKEY) -> c_int408 pub fn X509_CRL_verify(crl: *mut X509_CRL, pkey: *mut EVP_PKEY) -> c_int; X509_CRL_get0_by_cert( x: *mut X509_CRL, ret: *mut *mut X509_REVOKED, cert: *mut X509, ) -> c_int409 pub fn X509_CRL_get0_by_cert( 410 x: *mut X509_CRL, 411 ret: *mut *mut X509_REVOKED, 412 cert: *mut X509, 413 ) -> c_int; 414 } 415 const_ptr_api! { 416 extern "C" { 417 pub fn X509_CRL_get0_by_serial( 418 x: *mut X509_CRL, 419 ret: *mut *mut X509_REVOKED, 420 serial: #[const_ptr_if(ossl300)] ASN1_INTEGER, 421 ) -> c_int; 422 } 423 } 424 425 extern "C" { 426 #[cfg(any(ossl110, libressl281))] X509_CRL_get_REVOKED(crl: *mut X509_CRL) -> *mut stack_st_X509_REVOKED427 pub fn X509_CRL_get_REVOKED(crl: *mut X509_CRL) -> *mut stack_st_X509_REVOKED; 428 #[cfg(any(ossl110, libressl281))] X509_CRL_get0_nextUpdate(x: *const X509_CRL) -> *const ASN1_TIME429 pub fn X509_CRL_get0_nextUpdate(x: *const X509_CRL) -> *const ASN1_TIME; 430 #[cfg(any(ossl110, libressl281))] X509_CRL_get0_lastUpdate(x: *const X509_CRL) -> *const ASN1_TIME431 pub fn X509_CRL_get0_lastUpdate(x: *const X509_CRL) -> *const ASN1_TIME; 432 #[cfg(any(ossl110, libressl281))] X509_CRL_get_issuer(x: *const X509_CRL) -> *mut X509_NAME433 pub fn X509_CRL_get_issuer(x: *const X509_CRL) -> *mut X509_NAME; 434 435 #[cfg(ossl110)] X509_get0_extensions(req: *const ::X509) -> *const stack_st_X509_EXTENSION436 pub fn X509_get0_extensions(req: *const ::X509) -> *const stack_st_X509_EXTENSION; 437 X509_CRL_set_version(crl: *mut X509_CRL, version: c_long) -> c_int438 pub fn X509_CRL_set_version(crl: *mut X509_CRL, version: c_long) -> c_int; 439 } 440 const_ptr_api! { 441 extern "C" { 442 pub fn X509_CRL_set_issuer_name(crl: *mut X509_CRL, name: #[const_ptr_if(ossl300)] X509_NAME) -> c_int; 443 } 444 } 445 extern "C" { X509_CRL_sort(crl: *mut X509_CRL) -> c_int446 pub fn X509_CRL_sort(crl: *mut X509_CRL) -> c_int; 447 448 #[cfg(any(ossl110, libressl270))] X509_CRL_up_ref(crl: *mut X509_CRL) -> c_int449 pub fn X509_CRL_up_ref(crl: *mut X509_CRL) -> c_int; X509_CRL_add0_revoked(crl: *mut X509_CRL, rev: *mut X509_REVOKED) -> c_int450 pub fn X509_CRL_add0_revoked(crl: *mut X509_CRL, rev: *mut X509_REVOKED) -> c_int; 451 } 452 cfg_if! { 453 if #[cfg(any(ossl110, libressl270))] { 454 extern "C" { 455 pub fn X509_CRL_set1_lastUpdate(crl: *mut X509_CRL, tm: *const ASN1_TIME) -> c_int; 456 pub fn X509_CRL_set1_nextUpdate(crl: *mut X509_CRL, tm: *const ASN1_TIME) -> c_int; 457 } 458 } else { 459 // libressl270 kept them, ossl110 "#define"s them to the variants above 460 extern "C" { 461 pub fn X509_CRL_set_lastUpdate(crl: *mut X509_CRL, tm: *const ASN1_TIME) -> c_int; 462 pub fn X509_CRL_set_nextUpdate(crl: *mut X509_CRL, tm: *const ASN1_TIME) -> c_int; 463 } 464 } 465 } 466 467 const_ptr_api! { 468 extern "C" { 469 pub fn X509_NAME_entry_count(n: #[const_ptr_if(any(ossl110, libressl280))] X509_NAME) -> c_int; 470 pub fn X509_NAME_get_index_by_NID(n: #[const_ptr_if(any(ossl300, libressl280))] X509_NAME, nid: c_int, last_pos: c_int) -> c_int; 471 pub fn X509_NAME_get_entry(n: #[const_ptr_if(any(ossl110, libressl280))] X509_NAME, loc: c_int) -> *mut X509_NAME_ENTRY; 472 pub fn X509_NAME_add_entry_by_NID( 473 x: *mut X509_NAME, 474 field: c_int, 475 ty: c_int, 476 bytes: #[const_ptr_if(any(ossl110, libressl280))] c_uchar, 477 len: c_int, 478 loc: c_int, 479 set: c_int, 480 ) -> c_int; 481 pub fn X509_NAME_ENTRY_get_object(ne: #[const_ptr_if(any(ossl110, libressl280))] X509_NAME_ENTRY) -> *mut ASN1_OBJECT; 482 pub fn X509_NAME_ENTRY_get_data(ne: #[const_ptr_if(any(ossl110, libressl280))] X509_NAME_ENTRY) -> *mut ASN1_STRING; 483 } 484 } 485 extern "C" { X509_NAME_add_entry_by_txt( x: *mut X509_NAME, field: *const c_char, ty: c_int, bytes: *const c_uchar, len: c_int, loc: c_int, set: c_int, ) -> c_int486 pub fn X509_NAME_add_entry_by_txt( 487 x: *mut X509_NAME, 488 field: *const c_char, 489 ty: c_int, 490 bytes: *const c_uchar, 491 len: c_int, 492 loc: c_int, 493 set: c_int, 494 ) -> c_int; 495 } 496 497 // "raw" X509_EXTENSION related functions 498 extern "C" { 499 // in X509 X509_delete_ext(x: *mut X509, loc: c_int) -> *mut X509_EXTENSION500 pub fn X509_delete_ext(x: *mut X509, loc: c_int) -> *mut X509_EXTENSION; X509_add_ext(x: *mut X509, ext: *mut X509_EXTENSION, loc: c_int) -> c_int501 pub fn X509_add_ext(x: *mut X509, ext: *mut X509_EXTENSION, loc: c_int) -> c_int; X509_add1_ext_i2d( x: *mut X509, nid: c_int, value: *mut c_void, crit: c_int, flags: c_ulong, ) -> c_int502 pub fn X509_add1_ext_i2d( 503 x: *mut X509, 504 nid: c_int, 505 value: *mut c_void, 506 crit: c_int, 507 flags: c_ulong, 508 ) -> c_int; 509 // in X509_CRL X509_CRL_delete_ext(x: *mut X509_CRL, loc: c_int) -> *mut X509_EXTENSION510 pub fn X509_CRL_delete_ext(x: *mut X509_CRL, loc: c_int) -> *mut X509_EXTENSION; X509_CRL_add_ext(x: *mut X509_CRL, ext: *mut X509_EXTENSION, loc: c_int) -> c_int511 pub fn X509_CRL_add_ext(x: *mut X509_CRL, ext: *mut X509_EXTENSION, loc: c_int) -> c_int; X509_CRL_add1_ext_i2d( x: *mut X509_CRL, nid: c_int, value: *mut c_void, crit: c_int, flags: c_ulong, ) -> c_int512 pub fn X509_CRL_add1_ext_i2d( 513 x: *mut X509_CRL, 514 nid: c_int, 515 value: *mut c_void, 516 crit: c_int, 517 flags: c_ulong, 518 ) -> c_int; 519 // in X509_REVOKED X509_REVOKED_delete_ext(x: *mut X509_REVOKED, loc: c_int) -> *mut X509_EXTENSION520 pub fn X509_REVOKED_delete_ext(x: *mut X509_REVOKED, loc: c_int) -> *mut X509_EXTENSION; X509_REVOKED_add_ext( x: *mut X509_REVOKED, ext: *mut X509_EXTENSION, loc: c_int, ) -> c_int521 pub fn X509_REVOKED_add_ext( 522 x: *mut X509_REVOKED, 523 ext: *mut X509_EXTENSION, 524 loc: c_int, 525 ) -> c_int; X509_REVOKED_add1_ext_i2d( x: *mut X509_REVOKED, nid: c_int, value: *mut c_void, crit: c_int, flags: c_ulong, ) -> c_int526 pub fn X509_REVOKED_add1_ext_i2d( 527 x: *mut X509_REVOKED, 528 nid: c_int, 529 value: *mut c_void, 530 crit: c_int, 531 flags: c_ulong, 532 ) -> c_int; 533 // X509_EXTENSION stack 534 // - these getters always used *const STACK X509v3_get_ext_count(x: *const stack_st_X509_EXTENSION) -> c_int535 pub fn X509v3_get_ext_count(x: *const stack_st_X509_EXTENSION) -> c_int; X509v3_get_ext_by_NID( x: *const stack_st_X509_EXTENSION, nid: c_int, lastpos: c_int, ) -> c_int536 pub fn X509v3_get_ext_by_NID( 537 x: *const stack_st_X509_EXTENSION, 538 nid: c_int, 539 lastpos: c_int, 540 ) -> c_int; X509v3_get_ext_by_critical( x: *const stack_st_X509_EXTENSION, crit: c_int, lastpos: c_int, ) -> c_int541 pub fn X509v3_get_ext_by_critical( 542 x: *const stack_st_X509_EXTENSION, 543 crit: c_int, 544 lastpos: c_int, 545 ) -> c_int; X509v3_get_ext(x: *const stack_st_X509_EXTENSION, loc: c_int) -> *mut X509_EXTENSION546 pub fn X509v3_get_ext(x: *const stack_st_X509_EXTENSION, loc: c_int) -> *mut X509_EXTENSION; X509v3_delete_ext(x: *mut stack_st_X509_EXTENSION, loc: c_int) -> *mut X509_EXTENSION547 pub fn X509v3_delete_ext(x: *mut stack_st_X509_EXTENSION, loc: c_int) -> *mut X509_EXTENSION; X509v3_add_ext( x: *mut *mut stack_st_X509_EXTENSION, ex: *mut X509_EXTENSION, loc: c_int, ) -> *mut stack_st_X509_EXTENSION548 pub fn X509v3_add_ext( 549 x: *mut *mut stack_st_X509_EXTENSION, 550 ex: *mut X509_EXTENSION, 551 loc: c_int, 552 ) -> *mut stack_st_X509_EXTENSION; 553 // - X509V3_add1_i2d in x509v3.rs 554 // X509_EXTENSION itself X509_EXTENSION_create_by_NID( ex: *mut *mut X509_EXTENSION, nid: c_int, crit: c_int, data: *mut ASN1_OCTET_STRING, ) -> *mut X509_EXTENSION555 pub fn X509_EXTENSION_create_by_NID( 556 ex: *mut *mut X509_EXTENSION, 557 nid: c_int, 558 crit: c_int, 559 data: *mut ASN1_OCTET_STRING, 560 ) -> *mut X509_EXTENSION; X509_EXTENSION_set_critical(ex: *mut X509_EXTENSION, crit: c_int) -> c_int561 pub fn X509_EXTENSION_set_critical(ex: *mut X509_EXTENSION, crit: c_int) -> c_int; X509_EXTENSION_set_data(ex: *mut X509_EXTENSION, data: *mut ASN1_OCTET_STRING) -> c_int562 pub fn X509_EXTENSION_set_data(ex: *mut X509_EXTENSION, data: *mut ASN1_OCTET_STRING) -> c_int; X509_EXTENSION_get_object(ext: *mut X509_EXTENSION) -> *mut ASN1_OBJECT563 pub fn X509_EXTENSION_get_object(ext: *mut X509_EXTENSION) -> *mut ASN1_OBJECT; X509_EXTENSION_get_data(ext: *mut X509_EXTENSION) -> *mut ASN1_OCTET_STRING564 pub fn X509_EXTENSION_get_data(ext: *mut X509_EXTENSION) -> *mut ASN1_OCTET_STRING; 565 } 566 const_ptr_api! { 567 extern "C" { 568 // in X509 569 pub fn X509_get_ext_count(x: #[const_ptr_if(any(ossl110, libressl280))] X509) -> c_int; 570 pub fn X509_get_ext_by_NID(x: #[const_ptr_if(any(ossl110, libressl280))] X509, nid: c_int, lastpos: c_int) -> c_int; 571 pub fn X509_get_ext_by_OBJ(x: #[const_ptr_if(any(ossl110, libressl280))] X509, obj: #[const_ptr_if(any(ossl110, libressl280))] ASN1_OBJECT, lastpos: c_int) -> c_int; 572 pub fn X509_get_ext_by_critical(x: #[const_ptr_if(any(ossl110, libressl280))] X509, crit: c_int, lastpos: c_int) -> c_int; 573 pub fn X509_get_ext(x: #[const_ptr_if(any(ossl110, libressl280))] X509, loc: c_int) -> *mut X509_EXTENSION; 574 pub fn X509_get_ext_d2i( 575 x: #[const_ptr_if(any(ossl110, libressl280))] ::X509, 576 nid: c_int, 577 crit: *mut c_int, 578 idx: *mut c_int, 579 ) -> *mut c_void; 580 // in X509_CRL 581 pub fn X509_CRL_get_ext_count(x: #[const_ptr_if(any(ossl110, libressl280))] X509_CRL) -> c_int; 582 pub fn X509_CRL_get_ext_by_NID(x: #[const_ptr_if(any(ossl110, libressl280))] X509_CRL, nid: c_int, lastpos: c_int) -> c_int; 583 pub fn X509_CRL_get_ext_by_OBJ(x: #[const_ptr_if(any(ossl110, libressl280))] X509_CRL, obj: #[const_ptr_if(any(ossl110, libressl280))] ASN1_OBJECT, lastpos: c_int) -> c_int; 584 pub fn X509_CRL_get_ext_by_critical(x: #[const_ptr_if(any(ossl110, libressl280))] X509_CRL, crit: c_int, lastpos: c_int) -> c_int; 585 pub fn X509_CRL_get_ext(x: #[const_ptr_if(any(ossl110, libressl280))] X509_CRL, loc: c_int) -> *mut X509_EXTENSION; 586 pub fn X509_CRL_get_ext_d2i( 587 x: #[const_ptr_if(any(ossl110, libressl280))] ::X509_CRL, 588 nid: c_int, 589 crit: *mut c_int, 590 idx: *mut c_int, 591 ) -> *mut c_void; 592 // in X509_REVOKED 593 pub fn X509_REVOKED_get_ext_count(x: #[const_ptr_if(any(ossl110, libressl280))] X509_REVOKED) -> c_int; 594 pub fn X509_REVOKED_get_ext_by_NID(x: #[const_ptr_if(any(ossl110, libressl280))] X509_REVOKED, nid: c_int, lastpos: c_int) -> c_int; 595 pub fn X509_REVOKED_get_ext_by_OBJ(x: #[const_ptr_if(any(ossl110, libressl280))] X509_REVOKED, obj: #[const_ptr_if(any(ossl110, libressl280))] ASN1_OBJECT, lastpos: c_int) -> c_int; 596 pub fn X509_REVOKED_get_ext_by_critical(x: #[const_ptr_if(any(ossl110, libressl280))] X509_REVOKED, crit: c_int, lastpos: c_int) -> c_int; 597 pub fn X509_REVOKED_get_ext(x: #[const_ptr_if(any(ossl110, libressl280))] X509_REVOKED, loc: c_int) -> *mut X509_EXTENSION; 598 pub fn X509_REVOKED_get_ext_d2i( 599 x: #[const_ptr_if(any(ossl110, libressl280))] ::X509_REVOKED, 600 nid: c_int, 601 crit: *mut c_int, 602 idx: *mut c_int, 603 ) -> *mut c_void; 604 // X509_EXTENSION stack 605 pub fn X509v3_get_ext_by_OBJ(x: *const stack_st_X509_EXTENSION, obj: #[const_ptr_if(any(ossl110, libressl280))] ASN1_OBJECT, lastpos: c_int) -> c_int; 606 // X509_EXTENSION itself 607 pub fn X509_EXTENSION_create_by_OBJ(ex: *mut *mut X509_EXTENSION, obj: #[const_ptr_if(any(ossl110, libressl280))] ASN1_OBJECT, crit: c_int, data: *mut ASN1_OCTET_STRING) -> *mut X509_EXTENSION; 608 pub fn X509_EXTENSION_set_object(ex: *mut X509_EXTENSION, obj: #[const_ptr_if(any(ossl110, libressl280))] ASN1_OBJECT) -> c_int; 609 pub fn X509_EXTENSION_get_critical(ex: #[const_ptr_if(any(ossl110, libressl280))] X509_EXTENSION) -> c_int; 610 } 611 } 612 613 extern "C" { X509_verify_cert(ctx: *mut X509_STORE_CTX) -> c_int614 pub fn X509_verify_cert(ctx: *mut X509_STORE_CTX) -> c_int; 615 } 616 617 const_ptr_api! { 618 extern "C" { 619 #[cfg(any(ossl110, libressl270))] 620 pub fn X509_STORE_get0_objects(ctx: #[const_ptr_if(ossl300)] X509_STORE) -> *mut stack_st_X509_OBJECT; 621 } 622 } 623 #[cfg(any(ossl110, libressl270))] 624 extern "C" { X509_OBJECT_get0_X509(x: *const X509_OBJECT) -> *mut X509625 pub fn X509_OBJECT_get0_X509(x: *const X509_OBJECT) -> *mut X509; 626 } 627 628 cfg_if! { 629 if #[cfg(ossl110)] { 630 extern "C" { 631 pub fn X509_OBJECT_free(a: *mut X509_OBJECT); 632 } 633 } else { 634 extern "C" { 635 pub fn X509_OBJECT_free_contents(a: *mut X509_OBJECT); 636 } 637 } 638 } 639 640 extern "C" { X509_get_default_cert_file_env() -> *const c_char641 pub fn X509_get_default_cert_file_env() -> *const c_char; X509_get_default_cert_file() -> *const c_char642 pub fn X509_get_default_cert_file() -> *const c_char; X509_get_default_cert_dir_env() -> *const c_char643 pub fn X509_get_default_cert_dir_env() -> *const c_char; X509_get_default_cert_dir() -> *const c_char644 pub fn X509_get_default_cert_dir() -> *const c_char; 645 } 646