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    handles: {
19        pub sign_handle: crate::data::TpmiDhObject,
20    },
21    parameters: {
22        pub p1: Tpm2bEccPoint,
23        pub s2: Tpm2bSensitiveData,
24        pub y2: Tpm2bEccParameter,
25    }
26}
27
28tpm_struct! {
29    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
30    kind: Response,
31    name: TpmCommitResponse,
32    cc: TpmCc::Commit,
33    handles: {},
34    parameters: {
35        pub k: Tpm2bEccPoint,
36        pub l: Tpm2bEccPoint,
37        pub e: Tpm2bEccPoint,
38        pub counter: u16,
39    }
40}
41
42tpm_struct! {
43    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
44    kind: Command,
45    name: TpmEcEphemeralCommand,
46    cc: TpmCc::EcEphemeral,
47    handles: {},
48    parameters: {
49        pub curve_id: TpmEccCurve,
50    }
51}
52
53tpm_struct! {
54    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
55    kind: Response,
56    name: TpmEcEphemeralResponse,
57    cc: TpmCc::EcEphemeral,
58    handles: {},
59    parameters: {
60        pub q: Tpm2bEccPoint,
61        pub counter: u16,
62    }
63}