tpm2_protocol/message/
session.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// Copyright (c) 2025 Opinsys Oy
3
4//! 11.1 `TPM2_StartAuthSession`
5//! 11.2 `TPM2_PolicyRestart`
6
7use crate::{
8    data::{Tpm2bEncryptedSecret, Tpm2bNonce, TpmAlgId, TpmCc, TpmSe, TpmtSymDefObject},
9    tpm_struct, TpmSession,
10};
11use core::fmt::Debug;
12
13tpm_struct! {
14    #[derive(Debug, PartialEq, Eq, Clone)]
15    kind: Command,
16    name: TpmStartAuthSessionCommand,
17    cc: TpmCc::StartAuthSession,
18    handles: {
19        pub tpm_key: crate::data::TpmiDhObject,
20        pub bind: crate::data::TpmiDhObject,
21    },
22    parameters: {
23        pub nonce_caller: Tpm2bNonce,
24        pub encrypted_salt: Tpm2bEncryptedSecret,
25        pub session_type: TpmSe,
26        pub symmetric: TpmtSymDefObject,
27        pub auth_hash: TpmAlgId,
28    }
29}
30
31tpm_struct! {
32    #[derive(Debug, Default, PartialEq, Eq, Clone)]
33    kind: Response,
34    name: TpmStartAuthSessionResponse,
35    cc: TpmCc::StartAuthSession,
36    handles: {
37        pub session_handle: TpmSession,
38    },
39    parameters: {
40        pub nonce_tpm: Tpm2bNonce,
41    }
42}
43
44tpm_struct! {
45    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
46    kind: Command,
47    name: TpmPolicyRestartCommand,
48    cc: TpmCc::PolicyRestart,
49    handles: {
50        pub session_handle: crate::data::TpmiShAuthSession,
51    },
52    parameters: {}
53}
54
55tpm_struct! {
56    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
57    kind: Response,
58    name: TpmPolicyRestartResponse,
59    cc: TpmCc::PolicyRestart,
60    handles: {},
61    parameters: {}
62}