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
47    pub fn X509_STORE_add_cert(store: *mut X509_STORE, x: *mut X509) -> c_int;
48
49    pub fn X509_STORE_set_default_paths(store: *mut X509_STORE) -> c_int;
50    pub fn X509_STORE_set_flags(store: *mut X509_STORE, flags: c_ulong) -> c_int;
51    pub fn X509_STORE_set_purpose(ctx: *mut X509_STORE, purpose: c_int) -> c_int;
52    pub fn X509_STORE_set_trust(ctx: *mut X509_STORE, trust: c_int) -> c_int;
53
54}
55
56const_ptr_api! {
57    extern "C" {
58        pub fn X509_STORE_add_lookup(
59            store: *mut X509_STORE,
60            meth: #[const_ptr_if(libressl400)] X509_LOOKUP_METHOD,
61        ) -> *mut X509_LOOKUP;
62        pub fn X509_STORE_set1_param(store: *mut X509_STORE, pm: #[const_ptr_if(ossl300)] X509_VERIFY_PARAM) -> c_int;
63    }
64}
65
66const_ptr_api! {
67    extern "C" {
68        pub fn X509_STORE_CTX_get_ex_data(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX, idx: c_int) -> *mut c_void;
69        pub fn X509_STORE_CTX_get_error(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX) -> c_int;
70        pub fn X509_STORE_CTX_get_error_depth(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX) -> c_int;
71        pub fn X509_STORE_CTX_get_current_cert(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX) -> *mut X509;
72    }
73}
74extern "C" {
75    pub fn X509_STORE_CTX_set_error(ctx: *mut X509_STORE_CTX, error: c_int);
76}
77const_ptr_api! {
78    extern "C" {
79        pub fn X509_STORE_CTX_get0_chain(ctx: #[const_ptr_if(ossl300)] X509_STORE_CTX) -> *mut stack_st_X509;
80    }
81}
82
83extern "C" {
84    pub fn X509_VERIFY_PARAM_new() -> *mut X509_VERIFY_PARAM;
85    pub fn X509_VERIFY_PARAM_free(param: *mut X509_VERIFY_PARAM);
86
87    pub fn X509_VERIFY_PARAM_set_flags(param: *mut X509_VERIFY_PARAM, flags: c_ulong) -> c_int;
88    pub fn X509_VERIFY_PARAM_clear_flags(param: *mut X509_VERIFY_PARAM, flags: c_ulong) -> c_int;
89
90    pub fn X509_VERIFY_PARAM_set_time(param: *mut X509_VERIFY_PARAM, t: time_t);
91
92    pub fn X509_VERIFY_PARAM_set_depth(param: *mut X509_VERIFY_PARAM, depth: c_int);
93}
94const_ptr_api! {
95    extern "C" {
96        pub fn X509_VERIFY_PARAM_get_flags(param: #[const_ptr_if(ossl300)] X509_VERIFY_PARAM) -> c_ulong;
97    }
98}
99
100extern "C" {
101    pub fn X509_VERIFY_PARAM_set1_host(
102        param: *mut X509_VERIFY_PARAM,
103        name: *const c_char,
104        namelen: size_t,
105    ) -> c_int;
106    pub fn X509_VERIFY_PARAM_set_hostflags(param: *mut X509_VERIFY_PARAM, flags: c_uint);
107    pub fn X509_VERIFY_PARAM_set1_email(
108        param: *mut X509_VERIFY_PARAM,
109        email: *const c_char,
110        emaillen: size_t,
111    ) -> c_int;
112    pub fn X509_VERIFY_PARAM_set1_ip(
113        param: *mut X509_VERIFY_PARAM,
114        ip: *const c_uchar,
115        iplen: size_t,
116    ) -> c_int;
117    #[cfg(ossl110)]
118    pub fn X509_VERIFY_PARAM_set_auth_level(param: *mut X509_VERIFY_PARAM, lvl: c_int);
119    #[cfg(ossl110)]
120    pub fn X509_VERIFY_PARAM_get_auth_level(param: *const X509_VERIFY_PARAM) -> c_int;
121    pub fn X509_VERIFY_PARAM_set_purpose(param: *mut X509_VERIFY_PARAM, purpose: c_int) -> c_int;
122}