blob: 0f441e58551acfca93e8a93bbce804864ff9d76e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef __U2F_CMDS_H_INCLUDED__
#define __U2F_CMDS_H_INCLUDED__
/* Load platform hooks/definitions */
#include "common.h"
#include "tpm_vendor_cmds.h"
#include "u2f.h"
/* Until u2fd migrates to new structs, check they are compatible. */
BUILD_ASSERT(sizeof(struct u2f_key_handle_v0) == sizeof(struct u2f_key_handle));
BUILD_ASSERT(sizeof(struct u2f_key_handle_v1) ==
sizeof(struct u2f_versioned_key_handle));
BUILD_ASSERT(sizeof(struct u2f_signature) == sizeof(struct u2f_sign_resp));
BUILD_ASSERT(sizeof(struct u2f_signature) == sizeof(struct u2f_attest_resp));
BUILD_ASSERT(sizeof(struct u2f_key_handle_v0) == U2F_V0_KH_SIZE);
BUILD_ASSERT(sizeof(struct u2f_key_handle_v1) == U2F_V1_KH_SIZE);
BUILD_ASSERT(sizeof(struct u2f_key_handle_v2) == U2F_V2_KH_SIZE);
BUILD_ASSERT(sizeof(struct g2f_register_msg_v0) <= U2F_MAX_ATTEST_SIZE);
/**
* U2F_GENERATE command handler. Generates a key handle according to input
* parameters.
*/
enum vendor_cmd_rc u2f_generate_cmd(enum vendor_cmd_cc code, void *buf,
size_t input_size, size_t *response_size);
/**
* U2F_SIGN command handler. Verifies a key handle is owned and signs data with
* it.
*/
enum vendor_cmd_rc u2f_sign_cmd(enum vendor_cmd_cc code, void *buf,
size_t input_size, size_t *response_size);
/**
* U2F_ATTEST command handler.
*/
enum vendor_cmd_rc u2f_attest_cmd(enum vendor_cmd_cc code, void *buf,
size_t input_size, size_t *response_size);
/* Maximum size in bytes of G2F attestation certificate. */
#define G2F_ATTESTATION_CERT_MAX_LEN 315
/**
* Gets the x509 certificate for the attestation key pair returned
* by g2f_individual_keypair().
*
* @param buf pointer to a buffer that must be at least
* G2F_ATTESTATION_CERT_MAX_LEN bytes.
* @return size of certificate written to buf, 0 on error.
*/
size_t g2f_attestation_cert(uint8_t *buf);
#endif /* __U2F_CMDS_H_INCLUDED__ */
|