tpm2_protocol/message/
testing.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// Copyright (c) 2025 Opinsys Oy
3
4//! 10.2 `TPM2_SelfTest`
5//! 10.3 `TPM2_IncrementalSelfTest`
6//! 10.4 `TPM2_GetTestResult`
7
8use crate::{
9    data::{Tpm2bMaxBuffer, TpmCc, TpmRc, TpmiYesNo, TpmlAlg},
10    tpm_struct,
11};
12use core::fmt::Debug;
13
14tpm_struct! {
15    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
16    kind: Command,
17    name: TpmSelfTestCommand,
18    cc: TpmCc::SelfTest,
19    handles: {},
20    parameters: {
21        pub full_test: TpmiYesNo,
22    }
23}
24
25tpm_struct! {
26    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
27    kind: Response,
28    name: TpmSelfTestResponse,
29    cc: TpmCc::SelfTest,
30    handles: {},
31    parameters: {}
32}
33
34tpm_struct! {
35    #[derive(Debug, PartialEq, Eq, Clone)]
36    kind: Command,
37    name: TpmIncrementalSelfTestCommand,
38    cc: TpmCc::IncrementalSelfTest,
39    handles: {},
40    parameters: {
41        pub to_test: TpmlAlg,
42    }
43}
44
45tpm_struct! {
46    #[derive(Debug, Default, PartialEq, Eq, Clone)]
47    kind: Response,
48    name: TpmIncrementalSelfTestResponse,
49    cc: TpmCc::IncrementalSelfTest,
50    handles: {},
51    parameters: {
52        pub to_do_list: TpmlAlg,
53    }
54}
55
56tpm_struct! {
57    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
58    kind: Command,
59    name: TpmGetTestResultCommand,
60    cc: TpmCc::GetTestResult,
61    handles: {},
62    parameters: {}
63}
64
65tpm_struct! {
66    #[derive(Debug, PartialEq, Eq, Clone)]
67    kind: Response,
68    name: TpmGetTestResultResponse,
69    cc: TpmCc::GetTestResult,
70    handles: {},
71    parameters: {
72        pub out_data: Tpm2bMaxBuffer,
73        pub test_result: TpmRc,
74    }
75}