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    no_sessions: false,
19    with_sessions: true,
20    handles: {
21        pub key_handle: crate::data::TpmiDhObject,
22    },
23    parameters: {
24        pub digest: Tpm2bDigest,
25        pub in_scheme: TpmtSignature,
26        pub validation: TpmtTkHashcheck,
27    }
28}
29
30tpm_struct! {
31    #[derive(Debug, PartialEq, Eq, Clone)]
32    kind: Response,
33    name: TpmSignResponse,
34    cc: TpmCc::Sign,
35    no_sessions: false,
36    with_sessions: true,
37    handles: {},
38    parameters: {
39        pub signature: TpmtSignature,
40    }
41}
42
43tpm_struct! {
44    #[derive(Debug, PartialEq, Eq, Clone)]
45    kind: Command,
46    name: TpmVerifySignatureCommand,
47    cc: TpmCc::VerifySignature,
48    no_sessions: true,
49    with_sessions: false,
50    handles: {
51        pub key_handle: crate::data::TpmiDhObject,
52    },
53    parameters: {
54        pub digest: Tpm2bDigest,
55        pub signature: TpmtSignature,
56    }
57}
58
59tpm_struct! {
60    #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
61    kind: Response,
62    name: TpmVerifySignatureResponse,
63    cc: TpmCc::VerifySignature,
64    no_sessions: true,
65    with_sessions: false,
66    handles: {},
67    parameters: {
68        pub validation: TpmtTkVerified,
69    }
70}