blob: 7da52bc9827f461fd3f1a990b62f4e8c8edd1f2b [file] [log] [blame]
Namyoon Woof4428142019-10-30 19:02:58 -07001// Copyright 2019 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef TPM2_POLICYFIDOSIGNED_FP_H_
6#define TPM2_POLICYFIDOSIGNED_FP_H_
7
8#include "tpm_generated.h"
9
10/*
11 * Data range expression to select the segments in authenticatorData
12 * for policy digest extension
13 */
14typedef struct {
15 UINT16 offset;
16 UINT16 size;
17} DATA_OFFSET;
18
19/*
20 * Input data structure of PolicyFidoSigned command
21 */
22typedef struct {
23 TPMI_DH_OBJECT authObject;
24 TPMI_SH_POLICY policySession;
25
26 TPM2B_AUTHDATA authData;
27 UINT16 authDataDescrCount;
28 DATA_OFFSET authDataDescr[MAX_AUTH_DATA_DESCR_COUNT];
29
30 TPMT_SIGNATURE auth;
31} PolicyFidoSigned_In;
32
33/*
34 * Output data structure of PolicyFidoSigned command
35 */
36typedef struct {
37
38 /* No response parameter */
39
40} PolicyFidoSigned_Out;
41
42/*
43 * Process PolicyFidoSigned command
44 *
45 * @param in input buffer of request
46 * @param out output buffer of response
47 * @return TPM_RC_SUCCESS or
48 * TPM_RC_SIGNATURE if the signature is not genuine, or
49 * TPM_RC_SCHEME if the scheme is not supported, or
50 * TPM_RC_HANDLE if an HMAC key was selected but the private part of
51 * the key is not.
52 */
53TPM_RC TPM2_PolicyFidoSigned(PolicyFidoSigned_In* in,
54 PolicyFidoSigned_Out* out);
55
56/*
57 * Execute PolicyFidoSigned command, including unmarshaling/marshaling and
58 * processing
59 *
60 * Unmarshals any request parameters starting at |request_parameter_buffer|.
61 * Executes command. Marshals any response handles and parameters to the
62 * global response buffer and computes |*response_handle_buffer_size| and
63 * |*response_parameter_buffer_size|. If |tag| == TPM_ST_SESSIONS, marshals
64 * parameter_size indicating the size of the parameter area. parameter_size
65 * field is located between the handle area and parameter area.
66 *
67 * @param tag command tag
68 * @param req_param_buffer Buffer of request parameters
69 * @param req_param_buffer_size Buffer size of request parameters
70 * @param req_handles Array of request handles
71 * @param resp_handle_buf_size Buffer size of handles
72 * @param resp_param_buf_size Buffer size of response parameters
73 * @return TPM_RC_SUCCESS if processed successfully, or
74 * non-zero error code otherwise.
75 */
76TPM_RC Exec_PolicyFidoSigned(TPMI_ST_COMMAND_TAG tag,
77 BYTE** req_param_buffer,
78 INT32* req_param_buffer_size,
79 TPM_HANDLE req_handles[],
80 UINT32* resp_handle_buf_size,
81 UINT32* resp_param_buf_size);
82
83#endif // TPM2_POLICYFIDOSIGNED_FP_H_