1use super::super::*;
2use libc::*;
3
4#[repr(C)]
5pub struct ASN1_ENCODING {
6 pub enc: *mut c_uchar,
7 pub len: c_long,
8 pub modified: c_int,
9}
10
11extern "C" {
12 pub fn ASN1_OBJECT_free(x: *mut ASN1_OBJECT);
13 pub fn OBJ_dup(x: *const ASN1_OBJECT) -> *mut ASN1_OBJECT;
14}
15
16stack!(stack_st_ASN1_OBJECT);
17
18#[repr(C)]
19pub struct ASN1_TYPE {
20 pub type_: c_int,
21 pub value: ASN1_TYPE_value,
22}
23#[repr(C)]
24pub union ASN1_TYPE_value {
25 pub ptr: *mut c_char,
26 pub boolean: ASN1_BOOLEAN,
27 pub asn1_string: *mut ASN1_STRING,
28 pub object: *mut ASN1_OBJECT,
29 pub integer: *mut ASN1_INTEGER,
30 pub enumerated: *mut ASN1_ENUMERATED,
31 pub bit_string: *mut ASN1_BIT_STRING,
32 pub octet_string: *mut ASN1_OCTET_STRING,
33 pub printablestring: *mut ASN1_PRINTABLESTRING,
34 pub t61string: *mut ASN1_T61STRING,
35 pub ia5string: *mut ASN1_IA5STRING,
36 pub generalstring: *mut ASN1_GENERALSTRING,
37 pub bmpstring: *mut ASN1_BMPSTRING,
38 pub universalstring: *mut ASN1_UNIVERSALSTRING,
39 pub utctime: *mut ASN1_UTCTIME,
40 pub generalizedtime: *mut ASN1_GENERALIZEDTIME,
41 pub visiblestring: *mut ASN1_VISIBLESTRING,
42 pub utf8string: *mut ASN1_UTF8STRING,
43 pub set: *mut ASN1_STRING,
44 pub sequence: *mut ASN1_STRING,
45 pub asn1_value: *mut ASN1_VALUE,
46}
47
48extern "C" {
49 pub fn ASN1_STRING_type_new(ty: c_int) -> *mut ASN1_STRING;
50 #[cfg(any(ossl110, libressl273))]
51 pub fn ASN1_STRING_get0_data(x: *const ASN1_STRING) -> *const c_uchar;
52 #[cfg(any(all(ossl101, not(ossl110)), libressl))]
53 pub fn ASN1_STRING_data(x: *mut ASN1_STRING) -> *mut c_uchar;
54 pub fn ASN1_STRING_new() -> *mut ASN1_STRING;
55 pub fn ASN1_OCTET_STRING_new() -> *mut ASN1_OCTET_STRING;
56 pub fn ASN1_STRING_free(x: *mut ASN1_STRING);
57 pub fn ASN1_STRING_length(x: *const ASN1_STRING) -> c_int;
58 pub fn ASN1_STRING_set(x: *mut ASN1_STRING, data: *const c_void, len_in: c_int) -> c_int;
59 pub fn ASN1_OCTET_STRING_set(
60 x: *mut ASN1_OCTET_STRING,
61 data: *const c_uchar,
62 len_in: c_int,
63 ) -> c_int;
64
65 pub fn ASN1_BIT_STRING_free(x: *mut ASN1_BIT_STRING);
66 pub fn ASN1_OCTET_STRING_free(x: *mut ASN1_OCTET_STRING);
67
68 pub fn ASN1_GENERALIZEDTIME_free(tm: *mut ASN1_GENERALIZEDTIME);
69 pub fn ASN1_GENERALIZEDTIME_print(b: *mut BIO, tm: *const ASN1_GENERALIZEDTIME) -> c_int;
70 pub fn ASN1_TIME_new() -> *mut ASN1_TIME;
71 #[cfg(ossl102)]
72 pub fn ASN1_TIME_diff(
73 pday: *mut c_int,
74 psec: *mut c_int,
75 from: *const ASN1_TIME,
76 to: *const ASN1_TIME,
77 ) -> c_int;
78 pub fn ASN1_TIME_free(tm: *mut ASN1_TIME);
79 pub fn ASN1_TIME_print(b: *mut BIO, tm: *const ASN1_TIME) -> c_int;
80 pub fn ASN1_TIME_set(from: *mut ASN1_TIME, to: time_t) -> *mut ASN1_TIME;
81
82 pub fn ASN1_INTEGER_free(x: *mut ASN1_INTEGER);
83 pub fn ASN1_INTEGER_dup(a: *const ASN1_INTEGER) -> *mut ASN1_INTEGER;
84 pub fn ASN1_INTEGER_get(dest: *const ASN1_INTEGER) -> c_long;
85 pub fn ASN1_INTEGER_set(dest: *mut ASN1_INTEGER, value: c_long) -> c_int;
86 pub fn ASN1_INTEGER_cmp(a: *const ASN1_INTEGER, b: *const ASN1_INTEGER) -> c_int;
87 pub fn BN_to_ASN1_INTEGER(bn: *const BIGNUM, ai: *mut ASN1_INTEGER) -> *mut ASN1_INTEGER;
88 pub fn ASN1_INTEGER_to_BN(ai: *const ASN1_INTEGER, bn: *mut BIGNUM) -> *mut BIGNUM;
89
90 pub fn ASN1_TIME_set_string(s: *mut ASN1_TIME, str: *const c_char) -> c_int;
91 #[cfg(ossl111)]
92 pub fn ASN1_TIME_set_string_X509(s: *mut ASN1_TIME, str: *const c_char) -> c_int;
93
94 pub fn ASN1_ENUMERATED_free(a: *mut ASN1_ENUMERATED);
95 #[cfg(ossl110)]
96 pub fn ASN1_ENUMERATED_get_int64(pr: *mut i64, a: *const ASN1_ENUMERATED) -> c_int;
97
98 pub fn ASN1_TYPE_new() -> *mut ASN1_TYPE;
99 pub fn ASN1_TYPE_set(a: *mut ASN1_TYPE, type_: c_int, value: *mut c_void);
100 pub fn ASN1_TYPE_free(x: *mut ASN1_TYPE);
101 pub fn d2i_ASN1_TYPE(
102 k: *mut *mut ASN1_TYPE,
103 buf: *mut *const u8,
104 len: c_long,
105 ) -> *mut ASN1_TYPE;
106}
107
108const_ptr_api! {
109 extern "C" {
110 pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: #[const_ptr_if(any(ossl110, libressl280))] ASN1_STRING) -> c_int;
111 pub fn ASN1_STRING_type(x: #[const_ptr_if(any(ossl110, libressl280))] ASN1_STRING) -> c_int;
112 pub fn ASN1_generate_v3(str: #[const_ptr_if(any(ossl110, libressl280))] c_char, cnf: *mut X509V3_CTX) -> *mut ASN1_TYPE;
113 pub fn i2d_ASN1_TYPE(a: #[const_ptr_if(ossl300)] ASN1_TYPE, pp: *mut *mut c_uchar) -> c_int;
114 }
115}
116