tpm2_protocol/message/
signing.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2// Copyright (c) 2025 Opinsys Oy
3
4//! 20.1 `TPM2_VerifySignature`
5//! 20.2 `TPM2_Sign`
6
7use crate::{
8    data::{Tpm2bDigest, TpmCc, TpmtSignature, TpmtTkHashcheck, TpmtTkVerified},
9    tpm_struct,
10};
11use core::fmt::Debug;
12
13tpm_struct! {
14    #[derive(Debug, PartialEq, Eq, Clone)]
15    kind: Command,
16    name: TpmSignCommand,
17    cc: TpmCc::Sign,
18    handles: {
19        pub key_handle: crate::data::TpmiDhObject,
20    },
21    parameters: {
22        pub digest: Tpm2bDigest,
23        pub in_scheme: TpmtSignature,
24        pub validation: TpmtTkHashcheck,
25    }
26}
27
28tpm_struct! {
29    #[derive(Debug, PartialEq, Eq, Clone)]
30    kind: Response,
31    name: TpmSignResponse,
32    cc: TpmCc::Sign,
33    handles: {},
34    parameters: {
35        pub signature: TpmtSignature,
36    }
37}
38
39tpm_struct! {
40    #[derive(Debug, PartialEq, Eq, Clone)]
41    kind: Command,
42    name: TpmVerifySignatureCommand,
43    cc: TpmCc::VerifySignature,
44    handles: {
45        pub key_handle: crate::data::TpmiDhObject,
46    },
47    parameters: {
48        pub digest: Tpm2bDigest,
49        pub signature: TpmtSignature,
50    }
51}
52
53tpm_struct! {
54    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
55    kind: Response,
56    name: TpmVerifySignatureResponse,
57    cc: TpmCc::VerifySignature,
58    handles: {},
59    parameters: {
60        pub validation: TpmtTkVerified,
61    }
62}