1 // Copyright (c) 2023 Huawei Device Co., Ltd. 2 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // you may not use this file except in compliance with the License. 4 // You may obtain a copy of the License at 5 // 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 use libc::{c_char, c_int, c_long, c_uchar, c_uint, size_t}; 15 16 pub(crate) enum C_X509 {} 17 18 // for `C_X509` 19 extern "C" { X509_free(a: *mut C_X509)20 pub(crate) fn X509_free(a: *mut C_X509); 21 22 /// Returns a human readable error string for verification error n. X509_verify_cert_error_string(n: c_long) -> *const c_char23 pub(crate) fn X509_verify_cert_error_string(n: c_long) -> *const c_char; 24 25 /// Attempts to decode len bytes at *ppin.\ 26 /// If successful a pointer to the TYPE structure is returned and *ppin is 27 /// incremented to the byte following the parsed data. d2i_X509( a: *mut *mut C_X509, pp: *mut *const c_uchar, length: c_long, ) -> *mut C_X50928 pub(crate) fn d2i_X509( 29 a: *mut *mut C_X509, 30 pp: *mut *const c_uchar, 31 length: c_long, 32 ) -> *mut C_X509; 33 } 34 35 pub(crate) enum X509_STORE {} 36 37 // for `X509_STORE` 38 extern "C" { 39 /// Returns a new `X509_STORE`. X509_STORE_new() -> *mut X509_STORE40 pub(crate) fn X509_STORE_new() -> *mut X509_STORE; 41 42 /// Frees up a single `X509_STORE` object. X509_STORE_free(store: *mut X509_STORE)43 pub(crate) fn X509_STORE_free(store: *mut X509_STORE); 44 45 /// Adds the respective object to the X509_STORE's local storage. X509_STORE_add_cert(store: *mut X509_STORE, x: *mut C_X509) -> c_int46 pub(crate) fn X509_STORE_add_cert(store: *mut X509_STORE, x: *mut C_X509) -> c_int; 47 } 48 49 pub(crate) enum X509_STORE_CTX {} 50 51 pub(crate) enum X509_VERIFY_PARAM {} 52 53 // for `X509_VERIFY_PARAM` 54 extern "C" { X509_VERIFY_PARAM_free(param: *mut X509_VERIFY_PARAM)55 pub(crate) fn X509_VERIFY_PARAM_free(param: *mut X509_VERIFY_PARAM); 56 X509_VERIFY_PARAM_set_hostflags(param: *mut X509_VERIFY_PARAM, flags: c_uint)57 pub(crate) fn X509_VERIFY_PARAM_set_hostflags(param: *mut X509_VERIFY_PARAM, flags: c_uint); 58 X509_VERIFY_PARAM_set1_host( param: *mut X509_VERIFY_PARAM, name: *const c_char, namelen: size_t, ) -> c_int59 pub(crate) fn X509_VERIFY_PARAM_set1_host( 60 param: *mut X509_VERIFY_PARAM, 61 name: *const c_char, 62 namelen: size_t, 63 ) -> c_int; 64 X509_VERIFY_PARAM_set1_ip( param: *mut X509_VERIFY_PARAM, ip: *const c_uchar, iplen: size_t, ) -> c_int65 pub(crate) fn X509_VERIFY_PARAM_set1_ip( 66 param: *mut X509_VERIFY_PARAM, 67 ip: *const c_uchar, 68 iplen: size_t, 69 ) -> c_int; 70 } 71 72 pub(crate) enum STACK_X509 {} 73