| 1 |
use super::super::*; |
| 2 |
use std::ffi::{c_char, c_int, c_long, c_uchar, c_uint, c_ulong, c_void}; |
| 3 |
|
| 4 |
cfg_if! { |
| 5 |
if #[cfg(libressl400)] { |
| 6 |
pub enum X509_VAL {} |
| 7 |
} else { |
| 8 |
#[repr(C)] |
| 9 |
pub struct X509_VAL { |
| 10 |
pub notBefore: *mut ASN1_TIME, |
| 11 |
pub notAfter: *mut ASN1_TIME, |
| 12 |
} |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
pub enum X509_NAME_ENTRY {} |
| 17 |
|
| 18 |
stack!(stack_st_X509_NAME_ENTRY); |
| 19 |
|
| 20 |
stack!(stack_st_X509_NAME); |
| 21 |
|
| 22 |
pub enum X509_EXTENSION {} |
| 23 |
|
| 24 |
stack!(stack_st_X509_EXTENSION); |
| 25 |
|
| 26 |
pub enum X509_ATTRIBUTE {} |
| 27 |
|
| 28 |
stack!(stack_st_X509_ATTRIBUTE); |
| 29 |
|
| 30 |
pub enum X509_REQ_INFO {} |
| 31 |
|
| 32 |
pub enum X509_CRL {} |
| 33 |
|
| 34 |
stack!(stack_st_X509_CRL); |
| 35 |
|
| 36 |
pub enum X509_CRL_INFO {} |
| 37 |
|
| 38 |
pub enum X509_REVOKED {} |
| 39 |
|
| 40 |
stack!(stack_st_X509_REVOKED); |
| 41 |
|
| 42 |
pub enum X509_REQ {} |
| 43 |
|
| 44 |
pub enum X509_CINF {} |
| 45 |
|
| 46 |
stack!(stack_st_X509); |
| 47 |
|
| 48 |
stack!(stack_st_X509_OBJECT); |
| 49 |
|
| 50 |
stack!(stack_st_X509_LOOKUP); |
| 51 |
|
| 52 |
extern "C" { |
| 53 |
pub fn X509_verify_cert_error_string(n: c_long) -> *const c_char; |
| 54 |
|
| 55 |
pub fn X509_sign(x: *mut X509, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> c_int; |
| 56 |
|
| 57 |
pub fn X509_digest( |
| 58 |
x: *const X509, |
| 59 |
digest: *const EVP_MD, |
| 60 |
buf: *mut c_uchar, |
| 61 |
len: *mut c_uint, |
| 62 |
) -> c_int; |
| 63 |
|
| 64 |
pub fn X509_REQ_sign(x: *mut X509_REQ, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> c_int; |
| 65 |
} |
| 66 |
|
| 67 |
const_ptr_api! { |
| 68 |
extern "C" { |
| 69 |
pub fn i2d_X509_bio(b: *mut BIO, x: #[const_ptr_if(ossl300)] X509) -> c_int; |
| 70 |
pub fn i2d_X509_REQ_bio(b: *mut BIO, x: #[const_ptr_if(ossl300)] X509_REQ) -> c_int; |
| 71 |
pub fn i2d_PrivateKey_bio(b: *mut BIO, x: #[const_ptr_if(ossl300)] EVP_PKEY) -> c_int; |
| 72 |
pub fn i2d_PUBKEY_bio(b: *mut BIO, x: #[const_ptr_if(ossl300)] EVP_PKEY) -> c_int; |
| 73 |
|
| 74 |
pub fn i2d_PUBKEY(k: #[const_ptr_if(ossl300)] EVP_PKEY, buf: *mut *mut u8) -> c_int; |
| 75 |
pub fn i2d_PrivateKey(k: #[const_ptr_if(ossl300)] EVP_PKEY, buf: *mut *mut u8) -> c_int; |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))] |
| 80 |
const_ptr_api! { |
| 81 |
extern "C" { |
| 82 |
pub fn i2d_RSA_PUBKEY(k: #[const_ptr_if(ossl300)] RSA, buf: *mut *mut u8) -> c_int; |
| 83 |
pub fn i2d_DSA_PUBKEY(a: #[const_ptr_if(ossl300)] DSA, pp: *mut *mut c_uchar) -> c_int; |
| 84 |
pub fn i2d_ECPrivateKey(ec_key: #[const_ptr_if(ossl300)] EC_KEY, pp: *mut *mut c_uchar) -> c_int; |
| 85 |
pub fn i2d_EC_PUBKEY(a: #[const_ptr_if(ossl300)] EC_KEY, pp: *mut *mut c_uchar) -> c_int; |
| 86 |
} |
| 87 |
} |
| 88 |
extern "C" { |
| 89 |
pub fn d2i_PUBKEY(k: *mut *mut EVP_PKEY, buf: *mut *const u8, len: c_long) -> *mut EVP_PKEY; |
| 90 |
} |
| 91 |
|
| 92 |
#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))] |
| 93 |
extern "C" { |
| 94 |
pub fn d2i_RSA_PUBKEY(k: *mut *mut RSA, buf: *mut *const u8, len: c_long) -> *mut RSA; |
| 95 |
pub fn d2i_DSA_PUBKEY(k: *mut *mut DSA, pp: *mut *const c_uchar, length: c_long) -> *mut DSA; |
| 96 |
pub fn d2i_EC_PUBKEY( |
| 97 |
a: *mut *mut EC_KEY, |
| 98 |
pp: *mut *const c_uchar, |
| 99 |
length: c_long, |
| 100 |
) -> *mut EC_KEY; |
| 101 |
|
| 102 |
pub fn d2i_ECPrivateKey( |
| 103 |
k: *mut *mut EC_KEY, |
| 104 |
pp: *mut *const c_uchar, |
| 105 |
length: c_long, |
| 106 |
) -> *mut EC_KEY; |
| 107 |
} |
| 108 |
|
| 109 |
extern "C" { |
| 110 |
pub fn X509_ALGOR_get0( |
| 111 |
paobj: *mut *const ASN1_OBJECT, |
| 112 |
pptype: *mut c_int, |
| 113 |
ppval: *mut *const c_void, |
| 114 |
alg: *const X509_ALGOR, |
| 115 |
); |
| 116 |
} |
| 117 |
|
| 118 |
extern "C" { |
| 119 |
pub fn X509_gmtime_adj(time: *mut ASN1_TIME, adj: c_long) -> *mut ASN1_TIME; |
| 120 |
|
| 121 |
pub fn X509_to_X509_REQ(x: *mut X509, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> *mut X509_REQ; |
| 122 |
|
| 123 |
pub fn X509_ALGOR_free(x: *mut X509_ALGOR); |
| 124 |
|
| 125 |
pub fn X509_REVOKED_new() -> *mut X509_REVOKED; |
| 126 |
pub fn X509_REVOKED_free(x: *mut X509_REVOKED); |
| 127 |
} |
| 128 |
const_ptr_api! { |
| 129 |
extern "C" { |
| 130 |
pub fn X509_REVOKED_dup(rev: #[const_ptr_if(ossl300)] X509_REVOKED) -> *mut X509_REVOKED; |
| 131 |
} |
| 132 |
} |
| 133 |
|
| 134 |
extern "C" { |
| 135 |
pub fn d2i_X509_REVOKED( |
| 136 |
a: *mut *mut X509_REVOKED, |
| 137 |
pp: *mut *const c_uchar, |
| 138 |
length: c_long, |
| 139 |
) -> *mut X509_REVOKED; |
| 140 |
} |
| 141 |
const_ptr_api! { |
| 142 |
extern "C" { |
| 143 |
pub fn i2d_X509_REVOKED(x: #[const_ptr_if(ossl300)] X509_REVOKED, buf: *mut *mut u8) -> c_int; |
| 144 |
} |
| 145 |
} |
| 146 |
extern "C" { |
| 147 |
pub fn X509_CRL_new() -> *mut X509_CRL; |
| 148 |
pub fn X509_CRL_free(x: *mut X509_CRL); |
| 149 |
pub fn d2i_X509_CRL( |
| 150 |
a: *mut *mut X509_CRL, |
| 151 |
pp: *mut *const c_uchar, |
| 152 |
length: c_long, |
| 153 |
) -> *mut X509_CRL; |
| 154 |
} |
| 155 |
const_ptr_api! { |
| 156 |
extern "C" { |
| 157 |
pub fn i2d_X509_CRL(x: #[const_ptr_if(ossl300)] X509_CRL, buf: *mut *mut u8) -> c_int; |
| 158 |
pub fn X509_CRL_dup(x: #[const_ptr_if(ossl300)] X509_CRL) -> *mut X509_CRL; |
| 159 |
} |
| 160 |
} |
| 161 |
|
| 162 |
extern "C" { |
| 163 |
pub fn X509_REQ_new() -> *mut X509_REQ; |
| 164 |
pub fn X509_REQ_free(x: *mut X509_REQ); |
| 165 |
pub fn d2i_X509_REQ( |
| 166 |
a: *mut *mut X509_REQ, |
| 167 |
pp: *mut *const c_uchar, |
| 168 |
length: c_long, |
| 169 |
) -> *mut X509_REQ; |
| 170 |
} |
| 171 |
const_ptr_api! { |
| 172 |
extern "C" { |
| 173 |
pub fn i2d_X509_REQ(x: #[const_ptr_if(ossl300)] X509_REQ, buf: *mut *mut u8) -> c_int; |
| 174 |
|
| 175 |
pub fn X509_get0_signature( |
| 176 |
psig: *mut *const ASN1_BIT_STRING, |
| 177 |
palg: *mut *const X509_ALGOR, |
| 178 |
x: *const X509, |
| 179 |
); |
| 180 |
|
| 181 |
pub fn X509_REQ_dup(x: #[const_ptr_if(ossl300)] X509_REQ) -> *mut X509_REQ; |
| 182 |
} |
| 183 |
} |
| 184 |
extern "C" { |
| 185 |
#[cfg(ossl110)] |
| 186 |
pub fn X509_get_signature_nid(x: *const X509) -> c_int; |
| 187 |
|
| 188 |
pub fn X509_EXTENSION_free(ext: *mut X509_EXTENSION); |
| 189 |
|
| 190 |
pub fn X509_NAME_ENTRY_free(x: *mut X509_NAME_ENTRY); |
| 191 |
|
| 192 |
pub fn X509_NAME_new() -> *mut X509_NAME; |
| 193 |
pub fn X509_NAME_cmp(x: *const X509_NAME, y: *const X509_NAME) -> c_int; |
| 194 |
pub fn X509_NAME_free(x: *mut X509_NAME); |
| 195 |
|
| 196 |
pub fn X509_new() -> *mut X509; |
| 197 |
pub fn X509_free(x: *mut X509); |
| 198 |
} |
| 199 |
const_ptr_api! { |
| 200 |
extern "C" { |
| 201 |
pub fn i2d_X509(x: #[const_ptr_if(ossl300)] X509, buf: *mut *mut u8) -> c_int; |
| 202 |
pub fn X509_NAME_dup(x: #[const_ptr_if(ossl300)] X509_NAME) -> *mut X509_NAME; |
| 203 |
pub fn X509_dup(x: #[const_ptr_if(ossl300)] X509) -> *mut X509; |
| 204 |
pub fn X509_NAME_add_entry( |
| 205 |
name: *mut X509_NAME, |
| 206 |
ne: *const X509_NAME_ENTRY, |
| 207 |
loc: c_int, |
| 208 |
set: c_int, |
| 209 |
) -> c_int; |
| 210 |
} |
| 211 |
} |
| 212 |
extern "C" { |
| 213 |
pub fn d2i_X509(a: *mut *mut X509, pp: *mut *const c_uchar, length: c_long) -> *mut X509; |
| 214 |
pub fn d2i_X509_bio(b: *mut BIO, a: *mut *mut X509) -> *mut X509; |
| 215 |
|
| 216 |
pub fn X509_get_pubkey(x: *mut X509) -> *mut EVP_PKEY; |
| 217 |
|
| 218 |
pub fn X509_set_version(x: *mut X509, version: c_long) -> c_int; |
| 219 |
#[cfg(ossl110)] |
| 220 |
pub fn X509_get_version(x: *const X509) -> c_long; |
| 221 |
pub fn X509_set_serialNumber(x: *mut X509, sn: *mut ASN1_INTEGER) -> c_int; |
| 222 |
pub fn X509_get_serialNumber(x: *mut X509) -> *mut ASN1_INTEGER; |
| 223 |
pub fn X509_alias_get0(x: *mut X509, len: *mut c_int) -> *mut c_uchar; |
| 224 |
} |
| 225 |
const_ptr_api! { |
| 226 |
extern "C" { |
| 227 |
pub fn X509_set_issuer_name(x: *mut X509, name: #[const_ptr_if(ossl300)] X509_NAME) -> c_int; |
| 228 |
} |
| 229 |
} |
| 230 |
extern "C" { |
| 231 |
pub fn X509_issuer_name_hash(x: *mut X509) -> c_ulong; |
| 232 |
pub fn X509_subject_name_hash(x: *mut X509) -> c_ulong; |
| 233 |
} |
| 234 |
const_ptr_api! { |
| 235 |
extern "C" { |
| 236 |
pub fn X509_get_issuer_name(x: *const X509) -> *mut X509_NAME; |
| 237 |
pub fn X509_set_subject_name(x: *mut X509, name: #[const_ptr_if(ossl300)] X509_NAME) -> c_int; |
| 238 |
pub fn X509_get_subject_name(x: *const X509) -> *mut X509_NAME; |
| 239 |
} |
| 240 |
} |
| 241 |
extern "C" { |
| 242 |
pub fn X509_set1_notBefore(x: *mut X509, tm: *const ASN1_TIME) -> c_int; |
| 243 |
pub fn X509_set1_notAfter(x: *mut X509, tm: *const ASN1_TIME) -> c_int; |
| 244 |
} |
| 245 |
extern "C" { |
| 246 |
pub fn X509_REQ_get_version(req: *const X509_REQ) -> c_long; |
| 247 |
pub fn X509_REQ_set_version(req: *mut X509_REQ, version: c_long) -> c_int; |
| 248 |
pub fn X509_REQ_get_subject_name(req: *const X509_REQ) -> *mut X509_NAME; |
| 249 |
} |
| 250 |
const_ptr_api! { |
| 251 |
extern "C" { |
| 252 |
pub fn X509_REQ_set_subject_name(req: *mut X509_REQ, name: #[const_ptr_if(ossl300)] X509_NAME) -> c_int; |
| 253 |
} |
| 254 |
} |
| 255 |
extern "C" { |
| 256 |
pub fn X509_REQ_set_pubkey(req: *mut X509_REQ, pkey: *mut EVP_PKEY) -> c_int; |
| 257 |
pub fn X509_REQ_get_pubkey(req: *mut X509_REQ) -> *mut EVP_PKEY; |
| 258 |
pub fn X509_REQ_get_extensions(req: *mut X509_REQ) -> *mut stack_st_X509_EXTENSION; |
| 259 |
} |
| 260 |
const_ptr_api! { |
| 261 |
extern "C" { |
| 262 |
pub fn X509_REQ_add_extensions(req: *mut X509_REQ, exts: #[const_ptr_if(ossl300)] stack_st_X509_EXTENSION) |
| 263 |
-> c_int; |
| 264 |
} |
| 265 |
} |
| 266 |
extern "C" { |
| 267 |
pub fn X509_REQ_get_attr_count(req: *const X509_REQ) -> c_int; |
| 268 |
pub fn X509_REQ_get_attr_by_NID(req: *const X509_REQ, nid: c_int, lastpos: c_int) -> c_int; |
| 269 |
pub fn X509_REQ_get_attr(req: *const X509_REQ, loc: c_int) -> *mut X509_ATTRIBUTE; |
| 270 |
pub fn X509_REQ_delete_attr(req: *mut X509_REQ, loc: c_int) -> *mut X509_ATTRIBUTE; |
| 271 |
pub fn X509_REQ_add1_attr_by_txt( |
| 272 |
req: *mut X509_REQ, |
| 273 |
attrname: *const c_char, |
| 274 |
chtype: c_int, |
| 275 |
bytes: *const c_uchar, |
| 276 |
len: c_int, |
| 277 |
) -> c_int; |
| 278 |
pub fn X509_REQ_add1_attr_by_NID( |
| 279 |
req: *mut X509_REQ, |
| 280 |
nid: c_int, |
| 281 |
chtype: c_int, |
| 282 |
bytes: *const c_uchar, |
| 283 |
len: c_int, |
| 284 |
) -> c_int; |
| 285 |
pub fn X509_REQ_add1_attr_by_OBJ( |
| 286 |
req: *mut X509_REQ, |
| 287 |
obj: *const ASN1_OBJECT, |
| 288 |
chtype: c_int, |
| 289 |
bytes: *const c_uchar, |
| 290 |
len: c_int, |
| 291 |
) -> c_int; |
| 292 |
} |
| 293 |
extern "C" { |
| 294 |
pub fn X509_set_pubkey(x: *mut X509, pkey: *mut EVP_PKEY) -> c_int; |
| 295 |
pub fn X509_REQ_verify(req: *mut X509_REQ, pkey: *mut EVP_PKEY) -> c_int; |
| 296 |
pub fn X509_getm_notBefore(x: *const X509) -> *mut ASN1_TIME; |
| 297 |
pub fn X509_getm_notAfter(x: *const X509) -> *mut ASN1_TIME; |
| 298 |
pub fn X509_up_ref(x: *mut X509) -> c_int; |
| 299 |
|
| 300 |
pub fn X509_REVOKED_get0_serialNumber(req: *const X509_REVOKED) -> *const ASN1_INTEGER; |
| 301 |
pub fn X509_REVOKED_get0_revocationDate(req: *const X509_REVOKED) -> *const ASN1_TIME; |
| 302 |
pub fn X509_REVOKED_get0_extensions(r: *const X509_REVOKED) -> *const stack_st_X509_EXTENSION; |
| 303 |
|
| 304 |
pub fn X509_REVOKED_set_serialNumber(r: *mut X509_REVOKED, serial: *mut ASN1_INTEGER) -> c_int; |
| 305 |
pub fn X509_REVOKED_set_revocationDate(r: *mut X509_REVOKED, tm: *mut ASN1_TIME) -> c_int; |
| 306 |
|
| 307 |
pub fn X509_CRL_sign(x: *mut X509_CRL, pkey: *mut EVP_PKEY, md: *const EVP_MD) -> c_int; |
| 308 |
pub fn X509_CRL_digest( |
| 309 |
x: *const X509_CRL, |
| 310 |
digest: *const EVP_MD, |
| 311 |
md: *mut c_uchar, |
| 312 |
len: *mut c_uint, |
| 313 |
) -> c_int; |
| 314 |
pub fn X509_CRL_verify(crl: *mut X509_CRL, pkey: *mut EVP_PKEY) -> c_int; |
| 315 |
pub fn X509_CRL_get0_by_cert( |
| 316 |
x: *mut X509_CRL, |
| 317 |
ret: *mut *mut X509_REVOKED, |
| 318 |
cert: *mut X509, |
| 319 |
) -> c_int; |
| 320 |
} |
| 321 |
const_ptr_api! { |
| 322 |
extern "C" { |
| 323 |
pub fn X509_CRL_get0_by_serial( |
| 324 |
x: *mut X509_CRL, |
| 325 |
ret: *mut *mut X509_REVOKED, |
| 326 |
serial: #[const_ptr_if(ossl300)] ASN1_INTEGER, |
| 327 |
) -> c_int; |
| 328 |
} |
| 329 |
} |
| 330 |
|
| 331 |
extern "C" { |
| 332 |
pub fn X509_CRL_get_REVOKED(crl: *mut X509_CRL) -> *mut stack_st_X509_REVOKED; |
| 333 |
pub fn X509_CRL_get0_nextUpdate(x: *const X509_CRL) -> *const ASN1_TIME; |
| 334 |
pub fn X509_CRL_get0_lastUpdate(x: *const X509_CRL) -> *const ASN1_TIME; |
| 335 |
} |
| 336 |
const_ptr_api! { |
| 337 |
extern "C" { |
| 338 |
pub fn X509_CRL_get_issuer(x: *const X509_CRL) -> #[const_ptr_if(ossl400)] X509_NAME; |
| 339 |
} |
| 340 |
} |
| 341 |
extern "C" { |
| 342 |
|
| 343 |
#[cfg(ossl110)] |
| 344 |
pub fn X509_get0_extensions(req: *const X509) -> *const stack_st_X509_EXTENSION; |
| 345 |
|
| 346 |
pub fn X509_CRL_set_version(crl: *mut X509_CRL, version: c_long) -> c_int; |
| 347 |
} |
| 348 |
const_ptr_api! { |
| 349 |
extern "C" { |
| 350 |
pub fn X509_CRL_set_issuer_name(crl: *mut X509_CRL, name: #[const_ptr_if(ossl300)] X509_NAME) -> c_int; |
| 351 |
} |
| 352 |
} |
| 353 |
extern "C" { |
| 354 |
pub fn X509_CRL_sort(crl: *mut X509_CRL) -> c_int; |
| 355 |
|
| 356 |
pub fn X509_CRL_up_ref(crl: *mut X509_CRL) -> c_int; |
| 357 |
pub fn X509_CRL_add0_revoked(crl: *mut X509_CRL, rev: *mut X509_REVOKED) -> c_int; |
| 358 |
} |
| 359 |
extern "C" { |
| 360 |
pub fn X509_CRL_set1_lastUpdate(crl: *mut X509_CRL, tm: *const ASN1_TIME) -> c_int; |
| 361 |
pub fn X509_CRL_set1_nextUpdate(crl: *mut X509_CRL, tm: *const ASN1_TIME) -> c_int; |
| 362 |
} |
| 363 |
|
| 364 |
const_ptr_api! { |
| 365 |
extern "C" { |
| 366 |
pub fn X509_NAME_entry_count(n: *const X509_NAME) -> c_int; |
| 367 |
pub fn X509_NAME_get_index_by_NID(n: #[const_ptr_if(any(ossl300, libressl))] X509_NAME, nid: c_int, last_pos: c_int) -> c_int; |
| 368 |
pub fn X509_NAME_get_entry(n: *const X509_NAME, loc: c_int) -> *mut X509_NAME_ENTRY; |
| 369 |
pub fn X509_NAME_add_entry_by_NID( |
| 370 |
x: *mut X509_NAME, |
| 371 |
field: c_int, |
| 372 |
ty: c_int, |
| 373 |
bytes: *const c_uchar, |
| 374 |
len: c_int, |
| 375 |
loc: c_int, |
| 376 |
set: c_int, |
| 377 |
) -> c_int; |
| 378 |
pub fn i2d_X509_NAME(n: #[const_ptr_if(ossl300)] X509_NAME, buf: *mut *mut u8) -> c_int; |
| 379 |
pub fn X509_NAME_ENTRY_get_object(ne: *const X509_NAME_ENTRY) -> #[const_ptr_if(ossl400)] ASN1_OBJECT; |
| 380 |
pub fn X509_NAME_ENTRY_get_data(ne: *const X509_NAME_ENTRY) -> #[const_ptr_if(ossl400)] ASN1_STRING; |
| 381 |
} |
| 382 |
} |
| 383 |
extern "C" { |
| 384 |
pub fn X509_NAME_add_entry_by_txt( |
| 385 |
x: *mut X509_NAME, |
| 386 |
field: *const c_char, |
| 387 |
ty: c_int, |
| 388 |
bytes: *const c_uchar, |
| 389 |
len: c_int, |
| 390 |
loc: c_int, |
| 391 |
set: c_int, |
| 392 |
) -> c_int; |
| 393 |
pub fn d2i_X509_NAME( |
| 394 |
n: *mut *mut X509_NAME, |
| 395 |
pp: *mut *const c_uchar, |
| 396 |
length: c_long, |
| 397 |
) -> *mut X509_NAME; |
| 398 |
} |
| 399 |
|
| 400 |
// "raw" X509_EXTENSION related functions |
| 401 |
extern "C" { |
| 402 |
// in X509 |
| 403 |
pub fn X509_delete_ext(x: *mut X509, loc: c_int) -> *mut X509_EXTENSION; |
| 404 |
pub fn X509_add_ext(x: *mut X509, ext: *mut X509_EXTENSION, loc: c_int) -> c_int; |
| 405 |
pub fn X509_add1_ext_i2d( |
| 406 |
x: *mut X509, |
| 407 |
nid: c_int, |
| 408 |
value: *mut c_void, |
| 409 |
crit: c_int, |
| 410 |
flags: c_ulong, |
| 411 |
) -> c_int; |
| 412 |
// in X509_CRL |
| 413 |
pub fn X509_CRL_delete_ext(x: *mut X509_CRL, loc: c_int) -> *mut X509_EXTENSION; |
| 414 |
pub fn X509_CRL_add_ext(x: *mut X509_CRL, ext: *mut X509_EXTENSION, loc: c_int) -> c_int; |
| 415 |
pub fn X509_CRL_add1_ext_i2d( |
| 416 |
x: *mut X509_CRL, |
| 417 |
nid: c_int, |
| 418 |
value: *mut c_void, |
| 419 |
crit: c_int, |
| 420 |
flags: c_ulong, |
| 421 |
) -> c_int; |
| 422 |
// in X509_REVOKED |
| 423 |
pub fn X509_REVOKED_delete_ext(x: *mut X509_REVOKED, loc: c_int) -> *mut X509_EXTENSION; |
| 424 |
pub fn X509_REVOKED_add_ext( |
| 425 |
x: *mut X509_REVOKED, |
| 426 |
ext: *mut X509_EXTENSION, |
| 427 |
loc: c_int, |
| 428 |
) -> c_int; |
| 429 |
pub fn X509_REVOKED_add1_ext_i2d( |
| 430 |
x: *mut X509_REVOKED, |
| 431 |
nid: c_int, |
| 432 |
value: *mut c_void, |
| 433 |
crit: c_int, |
| 434 |
flags: c_ulong, |
| 435 |
) -> c_int; |
| 436 |
// X509_EXTENSION stack |
| 437 |
// - these getters always used *const STACK |
| 438 |
pub fn X509v3_get_ext_count(x: *const stack_st_X509_EXTENSION) -> c_int; |
| 439 |
pub fn X509v3_get_ext_by_NID( |
| 440 |
x: *const stack_st_X509_EXTENSION, |
| 441 |
nid: c_int, |
| 442 |
lastpos: c_int, |
| 443 |
) -> c_int; |
| 444 |
pub fn X509v3_get_ext_by_critical( |
| 445 |
x: *const stack_st_X509_EXTENSION, |
| 446 |
crit: c_int, |
| 447 |
lastpos: c_int, |
| 448 |
) -> c_int; |
| 449 |
pub fn X509v3_get_ext(x: *const stack_st_X509_EXTENSION, loc: c_int) -> *mut X509_EXTENSION; |
| 450 |
pub fn X509v3_delete_ext(x: *mut stack_st_X509_EXTENSION, loc: c_int) -> *mut X509_EXTENSION; |
| 451 |
pub fn X509v3_add_ext( |
| 452 |
x: *mut *mut stack_st_X509_EXTENSION, |
| 453 |
ex: *mut X509_EXTENSION, |
| 454 |
loc: c_int, |
| 455 |
) -> *mut stack_st_X509_EXTENSION; |
| 456 |
// - X509V3_add1_i2d in x509v3.rs |
| 457 |
// X509_EXTENSION itself |
| 458 |
pub fn X509_EXTENSION_create_by_NID( |
| 459 |
ex: *mut *mut X509_EXTENSION, |
| 460 |
nid: c_int, |
| 461 |
crit: c_int, |
| 462 |
data: *mut ASN1_OCTET_STRING, |
| 463 |
) -> *mut X509_EXTENSION; |
| 464 |
pub fn X509_EXTENSION_set_critical(ex: *mut X509_EXTENSION, crit: c_int) -> c_int; |
| 465 |
pub fn X509_EXTENSION_set_data(ex: *mut X509_EXTENSION, data: *mut ASN1_OCTET_STRING) -> c_int; |
| 466 |
pub fn X509_EXTENSION_get_object(ext: *mut X509_EXTENSION) -> *mut ASN1_OBJECT; |
| 467 |
pub fn X509_EXTENSION_get_data(ext: *mut X509_EXTENSION) -> *mut ASN1_OCTET_STRING; |
| 468 |
} |
| 469 |
|
| 470 |
const_ptr_api! { |
| 471 |
extern "C" { |
| 472 |
pub fn i2d_X509_EXTENSION(ext: #[const_ptr_if(ossl300)] X509_EXTENSION, pp: *mut *mut c_uchar) -> c_int; |
| 473 |
} |
| 474 |
} |
| 475 |
|
| 476 |
extern "C" { |
| 477 |
// in X509 |
| 478 |
pub fn X509_get_ext_count(x: *const X509) -> c_int; |
| 479 |
pub fn X509_get_ext_by_NID(x: *const X509, nid: c_int, lastpos: c_int) -> c_int; |
| 480 |
pub fn X509_get_ext_by_OBJ(x: *const X509, obj: *const ASN1_OBJECT, lastpos: c_int) -> c_int; |
| 481 |
pub fn X509_get_ext_by_critical(x: *const X509, crit: c_int, lastpos: c_int) -> c_int; |
| 482 |
pub fn X509_get_ext(x: *const X509, loc: c_int) -> *mut X509_EXTENSION; |
| 483 |
pub fn X509_get_ext_d2i( |
| 484 |
x: *const X509, |
| 485 |
nid: c_int, |
| 486 |
crit: *mut c_int, |
| 487 |
idx: *mut c_int, |
| 488 |
) -> *mut c_void; |
| 489 |
// in X509_CRL |
| 490 |
pub fn X509_CRL_get_ext_count(x: *const X509_CRL) -> c_int; |
| 491 |
pub fn X509_CRL_get_ext_by_NID(x: *const X509_CRL, nid: c_int, lastpos: c_int) -> c_int; |
| 492 |
pub fn X509_CRL_get_ext_by_OBJ( |
| 493 |
x: *const X509_CRL, |
| 494 |
obj: *const ASN1_OBJECT, |
| 495 |
lastpos: c_int, |
| 496 |
) -> c_int; |
| 497 |
pub fn X509_CRL_get_ext_by_critical(x: *const X509_CRL, crit: c_int, lastpos: c_int) -> c_int; |
| 498 |
pub fn X509_CRL_get_ext(x: *const X509_CRL, loc: c_int) -> *mut X509_EXTENSION; |
| 499 |
pub fn X509_CRL_get_ext_d2i( |
| 500 |
x: *const X509_CRL, |
| 501 |
nid: c_int, |
| 502 |
crit: *mut c_int, |
| 503 |
idx: *mut c_int, |
| 504 |
) -> *mut c_void; |
| 505 |
// in X509_REVOKED |
| 506 |
pub fn X509_REVOKED_get_ext_count(x: *const X509_REVOKED) -> c_int; |
| 507 |
pub fn X509_REVOKED_get_ext_by_NID(x: *const X509_REVOKED, nid: c_int, lastpos: c_int) |
| 508 |
-> c_int; |
| 509 |
pub fn X509_REVOKED_get_ext_by_OBJ( |
| 510 |
x: *const X509_REVOKED, |
| 511 |
obj: *const ASN1_OBJECT, |
| 512 |
lastpos: c_int, |
| 513 |
) -> c_int; |
| 514 |
pub fn X509_REVOKED_get_ext_by_critical( |
| 515 |
x: *const X509_REVOKED, |
| 516 |
crit: c_int, |
| 517 |
lastpos: c_int, |
| 518 |
) -> c_int; |
| 519 |
pub fn X509_REVOKED_get_ext(x: *const X509_REVOKED, loc: c_int) -> *mut X509_EXTENSION; |
| 520 |
pub fn X509_REVOKED_get_ext_d2i( |
| 521 |
x: *const X509_REVOKED, |
| 522 |
nid: c_int, |
| 523 |
crit: *mut c_int, |
| 524 |
idx: *mut c_int, |
| 525 |
) -> *mut c_void; |
| 526 |
// X509_EXTENSION stack |
| 527 |
pub fn X509v3_get_ext_by_OBJ( |
| 528 |
x: *const stack_st_X509_EXTENSION, |
| 529 |
obj: *const ASN1_OBJECT, |
| 530 |
lastpos: c_int, |
| 531 |
) -> c_int; |
| 532 |
// X509_EXTENSION itself |
| 533 |
pub fn X509_EXTENSION_create_by_OBJ( |
| 534 |
ex: *mut *mut X509_EXTENSION, |
| 535 |
obj: *const ASN1_OBJECT, |
| 536 |
crit: c_int, |
| 537 |
data: *mut ASN1_OCTET_STRING, |
| 538 |
) -> *mut X509_EXTENSION; |
| 539 |
pub fn X509_EXTENSION_set_object(ex: *mut X509_EXTENSION, obj: *const ASN1_OBJECT) -> c_int; |
| 540 |
pub fn X509_EXTENSION_get_critical(ex: *const X509_EXTENSION) -> c_int; |
| 541 |
} |
| 542 |
|
| 543 |
extern "C" { |
| 544 |
pub fn X509_verify_cert(ctx: *mut X509_STORE_CTX) -> c_int; |
| 545 |
} |
| 546 |
|
| 547 |
const_ptr_api! { |
| 548 |
extern "C" { |
| 549 |
pub fn X509_STORE_get0_objects(ctx: #[const_ptr_if(ossl300)] X509_STORE) -> *mut stack_st_X509_OBJECT; |
| 550 |
#[cfg(ossl300)] |
| 551 |
pub fn X509_STORE_get1_all_certs(ctx: *mut X509_STORE) -> *mut stack_st_X509; |
| 552 |
} |
| 553 |
} |
| 554 |
|
| 555 |
extern "C" { |
| 556 |
pub fn X509_OBJECT_get0_X509(x: *const X509_OBJECT) -> *mut X509; |
| 557 |
} |
| 558 |
|
| 559 |
extern "C" { |
| 560 |
pub fn X509_OBJECT_free(a: *mut X509_OBJECT); |
| 561 |
} |
| 562 |
|
| 563 |
extern "C" { |
| 564 |
pub fn X509_get_default_cert_file_env() -> *const c_char; |
| 565 |
pub fn X509_get_default_cert_file() -> *const c_char; |
| 566 |
pub fn X509_get_default_cert_dir_env() -> *const c_char; |
| 567 |
pub fn X509_get_default_cert_dir() -> *const c_char; |
| 568 |
} |
| 569 |
|
| 570 |
extern "C" { |
| 571 |
pub fn X509_cmp(a: *const X509, b: *const X509) -> c_int; |
| 572 |
pub fn X509_issuer_and_serial_cmp(a: *const X509, b: *const X509) -> c_int; |
| 573 |
pub fn X509_issuer_name_cmp(a: *const X509, b: *const X509) -> c_int; |
| 574 |
pub fn X509_subject_name_cmp(a: *const X509, b: *const X509) -> c_int; |
| 575 |
pub fn X509_CRL_cmp(a: *const X509_CRL, b: *const X509_CRL) -> c_int; |
| 576 |
pub fn X509_CRL_match(a: *const X509_CRL, b: *const X509_CRL) -> c_int; |
| 577 |
} |
| 578 |
|
| 579 |
extern "C" { |
| 580 |
pub fn X509_print(bio: *mut BIO, x509: *mut X509) -> c_int; |
| 581 |
pub fn X509_REQ_print(bio: *mut BIO, req: *mut X509_REQ) -> c_int; |
| 582 |
} |
| 583 |
|
| 584 |
cfg_if! { |
| 585 |
if #[cfg(libressl390)] { |
| 586 |
pub enum X509_PURPOSE {} |
| 587 |
} else { |
| 588 |
#[repr(C)] |
| 589 |
pub struct X509_PURPOSE { |
| 590 |
pub purpose: c_int, |
| 591 |
pub trust: c_int, // Default trust ID |
| 592 |
pub flags: c_int, |
| 593 |
pub check_purpose: |
| 594 |
Option<unsafe extern "C" fn(*const X509_PURPOSE, *const X509, c_int) -> c_int>, |
| 595 |
pub name: *mut c_char, |
| 596 |
pub sname: *mut c_char, |
| 597 |
pub usr_data: *mut c_void, |
| 598 |
} |
| 599 |
} |
| 600 |
} |
| 601 |
|
| 602 |
const_ptr_api! { |
| 603 |
extern "C" { |
| 604 |
pub fn X509_PURPOSE_get_by_sname(sname: *const c_char) -> c_int; |
| 605 |
pub fn X509_PURPOSE_get_id(purpose: *const X509_PURPOSE) -> c_int; |
| 606 |
pub fn X509_PURPOSE_get0(idx: c_int) -> #[const_ptr_if(libressl390)] X509_PURPOSE; |
| 607 |
} |
| 608 |
} |
| 609 |
|
| 610 |
extern "C" { |
| 611 |
pub fn X509_ATTRIBUTE_new() -> *mut X509_ATTRIBUTE; |
| 612 |
pub fn X509_ATTRIBUTE_free(attr: *mut X509_ATTRIBUTE); |
| 613 |
pub fn X509_ATTRIBUTE_create( |
| 614 |
nid: c_int, |
| 615 |
atrtype: c_int, |
| 616 |
value: *mut c_void, |
| 617 |
) -> *mut X509_ATTRIBUTE; |
| 618 |
pub fn X509_ATTRIBUTE_create_by_NID( |
| 619 |
attr: *mut *mut X509_ATTRIBUTE, |
| 620 |
nid: c_int, |
| 621 |
atrtype: c_int, |
| 622 |
data: *const c_void, |
| 623 |
len: c_int, |
| 624 |
) -> *mut X509_ATTRIBUTE; |
| 625 |
pub fn X509_ATTRIBUTE_create_by_OBJ( |
| 626 |
attr: *mut *mut X509_ATTRIBUTE, |
| 627 |
obj: *const ASN1_OBJECT, |
| 628 |
atrtype: c_int, |
| 629 |
data: *const c_void, |
| 630 |
len: c_int, |
| 631 |
) -> *mut X509_ATTRIBUTE; |
| 632 |
pub fn X509_ATTRIBUTE_create_by_txt( |
| 633 |
attr: *mut *mut X509_ATTRIBUTE, |
| 634 |
atrname: *const c_char, |
| 635 |
atrtype: c_int, |
| 636 |
bytes: *const c_uchar, |
| 637 |
len: c_int, |
| 638 |
) -> *mut X509_ATTRIBUTE; |
| 639 |
pub fn X509_ATTRIBUTE_set1_object(attr: *mut X509_ATTRIBUTE, obj: *const ASN1_OBJECT) -> c_int; |
| 640 |
pub fn X509_ATTRIBUTE_set1_data( |
| 641 |
attr: *mut X509_ATTRIBUTE, |
| 642 |
attrtype: c_int, |
| 643 |
data: *const c_void, |
| 644 |
len: c_int, |
| 645 |
) -> c_int; |
| 646 |
pub fn X509_ATTRIBUTE_get0_data( |
| 647 |
attr: *mut X509_ATTRIBUTE, |
| 648 |
idx: c_int, |
| 649 |
atrtype: c_int, |
| 650 |
data: *mut c_void, |
| 651 |
) -> *mut c_void; |
| 652 |
pub fn X509_ATTRIBUTE_get0_object(attr: *mut X509_ATTRIBUTE) -> *mut ASN1_OBJECT; |
| 653 |
pub fn X509_ATTRIBUTE_get0_type(attr: *mut X509_ATTRIBUTE, idx: c_int) -> *mut ASN1_TYPE; |
| 654 |
pub fn d2i_X509_ATTRIBUTE( |
| 655 |
a: *mut *mut X509_ATTRIBUTE, |
| 656 |
pp: *mut *const c_uchar, |
| 657 |
length: c_long, |
| 658 |
) -> *mut X509_ATTRIBUTE; |
| 659 |
} |
| 660 |
const_ptr_api! { |
| 661 |
extern "C" { |
| 662 |
pub fn X509_ATTRIBUTE_count(attr: *const X509_ATTRIBUTE) -> c_int; |
| 663 |
pub fn i2d_X509_ATTRIBUTE(x: #[const_ptr_if(ossl300)] X509_ATTRIBUTE, buf: *mut *mut u8) -> c_int; |
| 664 |
pub fn X509_ATTRIBUTE_dup(x: #[const_ptr_if(ossl300)] X509_ATTRIBUTE) -> *mut X509_ATTRIBUTE; |
| 665 |
} |
| 666 |
} |