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::{Tpm2b, 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    no_sessions: true,
19    with_sessions: true,
20    handles: {
21        pub tpm_key: crate::data::TpmiDhObject,
22        pub bind: crate::data::TpmiDhObject,
23    },
24    parameters: {
25        pub nonce_caller: Tpm2bNonce,
26        pub encrypted_salt: Tpm2b,
27        pub session_type: TpmSe,
28        pub symmetric: TpmtSymDefObject,
29        pub auth_hash: TpmAlgId,
30    }
31}
32
33tpm_struct! {
34    #[derive(Debug, Default, PartialEq, Eq, Clone)]
35    kind: Response,
36    name: TpmStartAuthSessionResponse,
37    cc: TpmCc::StartAuthSession,
38    no_sessions: true,
39    with_sessions: true,
40    handles: {
41        pub session_handle: TpmSession,
42    },
43    parameters: {
44        pub nonce_tpm: Tpm2bNonce,
45    }
46}
47
48tpm_struct! {
49    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
50    kind: Command,
51    name: TpmPolicyRestartCommand,
52    cc: TpmCc::PolicyRestart,
53    no_sessions: false,
54    with_sessions: true,
55    handles: {
56        pub session_handle: crate::data::TpmiShAuthSession,
57    },
58    parameters: {}
59}
60
61tpm_struct! {
62    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
63    kind: Response,
64    name: TpmPolicyRestartResponse,
65    cc: TpmCc::PolicyRestart,
66    no_sessions: false,
67    with_sessions: true,
68    handles: {},
69    parameters: {}
70}