1use crate::ffi_types::{c_char, c_int};
2use crate::rng::botan_rng_t;
3
4pub enum botan_tpm2_ctx_struct {}
5pub type botan_tpm2_ctx_t = *mut botan_tpm2_ctx_struct;
6
7pub enum botan_tpm2_session_struct {}
8pub type botan_tpm2_session_t = *mut botan_tpm2_session_struct;
9
10pub enum botan_tpm2_crypto_backend_state_struct {}
11pub type botan_tpm2_crypto_backend_state_t = *mut botan_tpm2_crypto_backend_state_struct;
12
13#[repr(C)]
15pub struct ESYS_CONTEXT {
16 _private: [u8; 0],
17}
18
19#[cfg(botan_ffi_20250506)]
20unsafe extern "C" {
21 pub fn botan_tpm2_supports_crypto_backend() -> c_int;
22
23 pub fn botan_tpm2_ctx_init(
24 ctx_out: *mut botan_tpm2_ctx_t,
25 tcti_nameconf: *const c_char,
26 ) -> c_int;
27
28 pub fn botan_tpm2_ctx_init_ex(
29 ctx_out: *mut botan_tpm2_ctx_t,
30 tcti_name: *const c_char,
31 tcti_conf: *const c_char,
32 ) -> c_int;
33
34 pub fn botan_tpm2_ctx_from_esys(
35 ctx_out: *mut botan_tpm2_ctx_t,
36 esys_ctx: *mut ESYS_CONTEXT,
37 ) -> c_int;
38
39 pub fn botan_tpm2_ctx_enable_crypto_backend(ctx: botan_tpm2_ctx_t, rng: botan_rng_t) -> c_int;
40
41 pub fn botan_tpm2_ctx_destroy(ctx: botan_tpm2_ctx_t) -> c_int;
42
43 pub fn botan_tpm2_enable_crypto_backend(
44 cbs_out: *mut botan_tpm2_crypto_backend_state_t,
45 esys_ctx: *mut ESYS_CONTEXT,
46 rng: botan_rng_t,
47 ) -> c_int;
48
49 pub fn botan_tpm2_crypto_backend_state_destroy(cbs: botan_tpm2_crypto_backend_state_t)
50 -> c_int;
51
52 pub fn botan_tpm2_rng_init(
53 rng_out: *mut botan_rng_t,
54 ctx: botan_tpm2_ctx_t,
55 s1: botan_tpm2_session_t,
56 s2: botan_tpm2_session_t,
57 s3: botan_tpm2_session_t,
58 ) -> c_int;
59
60 pub fn botan_tpm2_unauthenticated_session_init(
61 session_out: *mut botan_tpm2_session_t,
62 ctx: botan_tpm2_ctx_t,
63 ) -> c_int;
64
65 pub fn botan_tpm2_session_destroy(session: botan_tpm2_session_t) -> c_int;
66}