gmssl_sys/handwritten/
asn1.rs1use 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}
14
15stack!(stack_st_ASN1_OBJECT);
16
17#[repr(C)]
18pub struct ASN1_TYPE {
19 pub type_: c_int,
20 pub value: ASN1_TYPE_value,
21}
22#[repr(C)]
23pub union ASN1_TYPE_value {
24 pub ptr: *mut c_char,
25 pub boolean: ASN1_BOOLEAN,
26 pub asn1_string: *mut ASN1_STRING,
27 pub object: *mut ASN1_OBJECT,
28 pub integer: *mut ASN1_INTEGER,
29 pub enumerated: *mut ASN1_ENUMERATED,
30 pub bit_string: *mut ASN1_BIT_STRING,
31 pub octet_string: *mut ASN1_OCTET_STRING,
32 pub printablestring: *mut ASN1_PRINTABLESTRING,
33 pub t61string: *mut ASN1_T61STRING,
34 pub ia5string: *mut ASN1_IA5STRING,
35 pub generalstring: *mut ASN1_GENERALSTRING,
36 pub bmpstring: *mut ASN1_BMPSTRING,
37 pub universalstring: *mut ASN1_UNIVERSALSTRING,
38 pub utctime: *mut ASN1_UTCTIME,
39 pub generalizedtime: *mut ASN1_GENERALIZEDTIME,
40 pub visiblestring: *mut ASN1_VISIBLESTRING,
41 pub utf8string: *mut ASN1_UTF8STRING,
42 pub set: *mut ASN1_STRING,
43 pub sequence: *mut ASN1_STRING,
44 pub asn1_value: *mut ASN1_VALUE,
45}
46
47extern "C" {
48 pub fn ASN1_STRING_type_new(ty: c_int) -> *mut ASN1_STRING;
49 #[cfg(any(ossl110, libressl273))]
50 pub fn ASN1_STRING_get0_data(x: *const ASN1_STRING) -> *const c_uchar;
51 #[cfg(any(all(ossl101, not(ossl110)), libressl))]
52 pub fn ASN1_STRING_data(x: *mut ASN1_STRING) -> *mut c_uchar;
53 pub fn ASN1_STRING_new() -> *mut ASN1_STRING;
54 pub fn ASN1_STRING_free(x: *mut ASN1_STRING);
55 pub fn ASN1_STRING_length(x: *const ASN1_STRING) -> c_int;
56 pub fn ASN1_STRING_set(x: *mut ASN1_STRING, data: *const c_void, len_in: c_int) -> c_int;
57
58 pub fn ASN1_BIT_STRING_free(x: *mut ASN1_BIT_STRING);
59 pub fn ASN1_OCTET_STRING_free(x: *mut ASN1_OCTET_STRING);
60
61 pub fn ASN1_GENERALIZEDTIME_free(tm: *mut ASN1_GENERALIZEDTIME);
62 pub fn ASN1_GENERALIZEDTIME_print(b: *mut BIO, tm: *const ASN1_GENERALIZEDTIME) -> c_int;
63 pub fn ASN1_TIME_new() -> *mut ASN1_TIME;
64 #[cfg(ossl102)]
65 pub fn ASN1_TIME_diff(
66 pday: *mut c_int,
67 psec: *mut c_int,
68 from: *const ASN1_TIME,
69 to: *const ASN1_TIME,
70 ) -> c_int;
71 pub fn ASN1_TIME_free(tm: *mut ASN1_TIME);
72 pub fn ASN1_TIME_print(b: *mut BIO, tm: *const ASN1_TIME) -> c_int;
73 pub fn ASN1_TIME_set(from: *mut ASN1_TIME, to: time_t) -> *mut ASN1_TIME;
74
75 pub fn ASN1_INTEGER_free(x: *mut ASN1_INTEGER);
76 pub fn ASN1_INTEGER_dup(a: *const ASN1_INTEGER) -> *mut ASN1_INTEGER;
77 pub fn ASN1_INTEGER_get(dest: *const ASN1_INTEGER) -> c_long;
78 pub fn ASN1_INTEGER_set(dest: *mut ASN1_INTEGER, value: c_long) -> c_int;
79 pub fn ASN1_INTEGER_cmp(a: *const ASN1_INTEGER, b: *const ASN1_INTEGER) -> c_int;
80 pub fn BN_to_ASN1_INTEGER(bn: *const BIGNUM, ai: *mut ASN1_INTEGER) -> *mut ASN1_INTEGER;
81 pub fn ASN1_INTEGER_to_BN(ai: *const ASN1_INTEGER, bn: *mut BIGNUM) -> *mut BIGNUM;
82
83 pub fn ASN1_TIME_set_string(s: *mut ASN1_TIME, str: *const c_char) -> c_int;
84 #[cfg(ossl111)]
85 pub fn ASN1_TIME_set_string_X509(s: *mut ASN1_TIME, str: *const c_char) -> c_int;
86
87 pub fn ASN1_ENUMERATED_free(a: *mut ASN1_ENUMERATED);
88 #[cfg(ossl110)]
89 pub fn ASN1_ENUMERATED_get_int64(pr: *mut i64, a: *const ASN1_ENUMERATED) -> c_int;
90
91 pub fn ASN1_TYPE_free(x: *mut ASN1_TYPE);
92}
93
94const_ptr_api! {
95 extern "C" {
96 pub fn ASN1_STRING_to_UTF8(out: *mut *mut c_uchar, s: #[const_ptr_if(any(ossl110, libressl280))] ASN1_STRING) -> c_int;
97 pub fn ASN1_STRING_type(x: #[const_ptr_if(any(ossl110, libressl280))] ASN1_STRING) -> c_int;
98 pub fn ASN1_generate_v3(str: #[const_ptr_if(any(ossl110, libressl280))] c_char, cnf: *mut X509V3_CTX) -> *mut ASN1_TYPE;
99 }
100}