tpm2_protocol/message/
ephemeral.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// Copyright (c) 2025 Opinsys Oy
3
4//! 19.2 `TPM2_Commit`
5//! 19.3 `TPM2_EC_Ephemeral`
6
7use crate::{
8    data::{Tpm2bEccParameter, Tpm2bEccPoint, Tpm2bSensitiveData, TpmCc, TpmEccCurve},
9    tpm_struct,
10};
11use core::fmt::Debug;
12
13tpm_struct! {
14    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
15    kind: Command,
16    name: TpmCommitCommand,
17    cc: TpmCc::Commit,
18    no_sessions: false,
19    with_sessions: true,
20    handles: {
21        pub sign_handle: crate::data::TpmiDhObject,
22    },
23    parameters: {
24        pub p1: Tpm2bEccPoint,
25        pub s2: Tpm2bSensitiveData,
26        pub y2: Tpm2bEccParameter,
27    }
28}
29
30tpm_struct! {
31    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
32    kind: Response,
33    name: TpmCommitResponse,
34    cc: TpmCc::Commit,
35    no_sessions: false,
36    with_sessions: true,
37    handles: {},
38    parameters: {
39        pub k: Tpm2bEccPoint,
40        pub l: Tpm2bEccPoint,
41        pub e: Tpm2bEccPoint,
42        pub counter: u16,
43    }
44}
45
46tpm_struct! {
47    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
48    kind: Command,
49    name: TpmEcEphemeralCommand,
50    cc: TpmCc::EcEphemeral,
51    no_sessions: true,
52    with_sessions: false,
53    handles: {},
54    parameters: {
55        pub curve_id: TpmEccCurve,
56    }
57}
58
59tpm_struct! {
60    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
61    kind: Response,
62    name: TpmEcEphemeralResponse,
63    cc: TpmCc::EcEphemeral,
64    no_sessions: true,
65    with_sessions: false,
66    handles: {},
67    parameters: {
68        pub q: Tpm2bEccPoint,
69        pub counter: u16,
70    }
71}