Skip to main content

openssl_sys/handwritten/
x509_vfy.rs

1use super::super::*;
2use libc::{size_t, time_t};
3use std::ffi::{c_char, c_int, c_long, c_uchar, c_uint, c_ulong, c_void};
4
5#[cfg(all(libressl, not(libressl430)))]
6pub enum X509_VERIFY_PARAM_ID {}
7
8extern "C" {
9    #[cfg(ossl110)]
10    pub fn X509_LOOKUP_meth_free(method: *mut X509_LOOKUP_METHOD);
11}
12
13const_ptr_api! {
14    extern "C" {
15        pub fn X509_LOOKUP_hash_dir() -> #[const_ptr_if(libressl400)] X509_LOOKUP_METHOD;
16        pub fn X509_LOOKUP_file() -> #[const_ptr_if(libressl400)] X509_LOOKUP_METHOD;
17    }
18}
19extern "C" {
20    pub fn X509_LOOKUP_free(ctx: *mut X509_LOOKUP);
21    pub fn X509_LOOKUP_ctrl(
22        ctx: *mut X509_LOOKUP,
23        cmd: c_int,
24        argc: *const c_char,
25        argl: c_long,
26        ret: *mut *mut c_char,
27    ) -> c_int;
28    pub fn X509_load_cert_file(ctx: *mut X509_LOOKUP, file: *const c_char, _type: c_int) -> c_int;
29    pub fn X509_load_crl_file(ctx: *mut X509_LOOKUP, file: *const c_char, _type: c_int) -> c_int;
30}
31
32extern "C" {
33    pub fn X509_STORE_new() -> *mut X509_STORE;
34    pub fn X509_STORE_free(store: *mut X509_STORE);
35
36    pub fn X509_STORE_CTX_new() -> *mut X509_STORE_CTX;
37
38    pub fn X509_STORE_CTX_free(ctx: *mut X509_STORE_CTX);
39    pub fn X509_STORE_CTX_init(
40        ctx: *mut X509_STORE_CTX,
41        store: *mut X509_STORE,
42        x509: *mut X509,
43        chain: *mut stack_st_X509,
44    ) -> c_int;
45    pub fn X509_STORE_CTX_cleanup(ctx: *mut X509_STORE_CTX);
46    pub fn X509_STORE_CTX_set_cert(ctx: *mut X509_STORE_CTX, x: *mut X509);
47    pub fn X509_STORE_CTX_set_current_cert(ctx: *mut X509_STORE_CTX, x: *mut X509);
48
49    pub fn X509_STORE_add_cert(store: *mut X509_STORE, x: *mut X509) -> c_int;
50
51    pub fn X509_STORE_set_default_paths(store: *mut X509_STORE) -> c_int;
52    pub fn X509_STORE_set_flags(store: *mut X509_STORE, flags: c_ulong) -> c_int;
53    pub fn X509_STORE_set_purpose(ctx: *mut X509_STORE, purpose: c_int) -> c_int;
54    pub fn X509_STORE_set_trust(ctx: *mut X509_STORE, trust: c_int) -> c_int;
55
56}
57
58const_ptr_api! {
59    extern "C" {
60        pub fn X509_STORE_add_lookup(
61            store: *mut X509_STORE,
62            meth: #[const_ptr_if(libressl400)] X509_LOOKUP_METHOD,
63        ) -> *mut X509_LOOKUP;
64        pub fn X509_STORE_set1_param(store: *mut X509_STORE, pm: #[const_ptr_if(ossl300)] X509_VERIFY_PARAM) -> c_int;
65    }
66}
67
68const_ptr_api! {
69    extern "C" {
70        pub fn X509_STORE_CTX_get_ex_data(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX, idx: c_int) -> *mut c_void;
71        pub fn X509_STORE_CTX_get_error(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX) -> c_int;
72        pub fn X509_STORE_CTX_get_error_depth(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX) -> c_int;
73        pub fn X509_STORE_CTX_get_current_cert(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX) -> *mut X509;
74    }
75}
76extern "C" {
77    pub fn X509_STORE_CTX_set_error(ctx: *mut X509_STORE_CTX, error: c_int);
78}
79const_ptr_api! {
80    extern "C" {
81        pub fn X509_STORE_CTX_get0_chain(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX) -> *mut stack_st_X509;
82    }
83}
84
85extern "C" {
86    pub fn X509_VERIFY_PARAM_new() -> *mut X509_VERIFY_PARAM;
87    pub fn X509_VERIFY_PARAM_free(param: *mut X509_VERIFY_PARAM);
88
89    pub fn X509_VERIFY_PARAM_set_flags(param: *mut X509_VERIFY_PARAM, flags: c_ulong) -> c_int;
90    pub fn X509_VERIFY_PARAM_clear_flags(param: *mut X509_VERIFY_PARAM, flags: c_ulong) -> c_int;
91
92    pub fn X509_VERIFY_PARAM_set_time(param: *mut X509_VERIFY_PARAM, t: time_t);
93
94    pub fn X509_VERIFY_PARAM_set_depth(param: *mut X509_VERIFY_PARAM, depth: c_int);
95}
96const_ptr_api! {
97    extern "C" {
98        pub fn X509_VERIFY_PARAM_get_flags(param: #[const_ptr_if(ossl300)] X509_VERIFY_PARAM) -> c_ulong;
99    }
100}
101
102extern "C" {
103    pub fn X509_VERIFY_PARAM_set1_host(
104        param: *mut X509_VERIFY_PARAM,
105        name: *const c_char,
106        namelen: size_t,
107    ) -> c_int;
108    pub fn X509_VERIFY_PARAM_set_hostflags(param: *mut X509_VERIFY_PARAM, flags: c_uint);
109    pub fn X509_VERIFY_PARAM_set1_email(
110        param: *mut X509_VERIFY_PARAM,
111        email: *const c_char,
112        emaillen: size_t,
113    ) -> c_int;
114    pub fn X509_VERIFY_PARAM_set1_ip(
115        param: *mut X509_VERIFY_PARAM,
116        ip: *const c_uchar,
117        iplen: size_t,
118    ) -> c_int;
119    #[cfg(ossl110)]
120    pub fn X509_VERIFY_PARAM_set_auth_level(param: *mut X509_VERIFY_PARAM, lvl: c_int);
121    #[cfg(ossl110)]
122    pub fn X509_VERIFY_PARAM_get_auth_level(param: *const X509_VERIFY_PARAM) -> c_int;
123    pub fn X509_VERIFY_PARAM_set_purpose(param: *mut X509_VERIFY_PARAM, purpose: c_int) -> c_int;
124}