tpm2_protocol/message/
clocks_and_timers.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// Copyright (c) 2025 Opinsys Oy
3// Copyright (c) 2024-2025 Jarkko Sakkinen
4
5//! 29 Clocks and Timers
6
7use crate::{
8    data::{TpmCc, TpmClockAdjust, TpmsTimeInfo},
9    tpm_struct,
10};
11use core::fmt::Debug;
12
13tpm_struct! {
14    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
15    kind: Command,
16    name: TpmReadClockCommand,
17    cc: TpmCc::ReadClock,
18    no_sessions: true,
19    with_sessions: false,
20    handles: {},
21    parameters: {}
22}
23
24tpm_struct! {
25    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
26    kind: Response,
27    name: TpmReadClockResponse,
28    cc: TpmCc::ReadClock,
29    no_sessions: true,
30    with_sessions: false,
31    handles: {},
32    parameters: {
33        pub current_time: TpmsTimeInfo,
34    }
35}
36
37tpm_struct! {
38    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
39    kind: Command,
40    name: TpmClockSetCommand,
41    cc: TpmCc::ClockSet,
42    no_sessions: false,
43    with_sessions: true,
44    handles: {
45        pub auth: crate::data::TpmiRhHierarchy,
46    },
47    parameters: {
48        pub new_time: u64,
49    }
50}
51
52tpm_struct! {
53    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
54    kind: Response,
55    name: TpmClockSetResponse,
56    cc: TpmCc::ClockSet,
57    no_sessions: false,
58    with_sessions: true,
59    handles: {},
60    parameters: {}
61}
62
63tpm_struct! {
64    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
65    kind: Command,
66    name: TpmClockRateAdjustCommand,
67    cc: TpmCc::ClockRateAdjust,
68    no_sessions: false,
69    with_sessions: true,
70    handles: {
71        pub auth: crate::data::TpmiRhHierarchy,
72    },
73    parameters: {
74        pub rate_adjust: TpmClockAdjust,
75    }
76}
77
78tpm_struct! {
79    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
80    kind: Response,
81    name: TpmClockRateAdjustResponse,
82    cc: TpmCc::ClockRateAdjust,
83    no_sessions: false,
84    with_sessions: true,
85    handles: {},
86    parameters: {}
87}