Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
u2f_transport.h
Go to the documentation of this file.
1/*****************************************************************************
2 * (c) 2025 Ledger SAS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
19/* Includes ------------------------------------------------------------------*/
20#include <stdbool.h>
21#include <stdint.h>
22#include "u2f_types.h"
23
24/* Exported enumerations -----------------------------------------------------*/
29
30/* Exported types, structures, unions ----------------------------------------*/
31typedef struct {
33
34 uint32_t cid;
35 uint8_t state;
36
38 uint32_t tx_cid;
39
40 // A packet refused by the channel checks, kept until answered without touching cid/tx_cid.
42 uint32_t reject_cid;
44
45 // The message being sent ends the transaction once its last packet reaches the host.
47
48 const uint8_t *tx_message_buffer;
52
54
60
62
63/* Exported defines --------------------------------------------------------*/
64#define U2F_FORBIDDEN_CID (0x00000000)
65#define U2F_BROADCAST_CID (0xFFFFFFFF)
66
67/* Exported macros------------------------------------------------------------*/
68
69/* Exported variables --------------------------------------------------------*/
70
71/* Exported functions prototypes--------------------------------------------- */
72void U2F_TRANSPORT_init(u2f_transport_t *handle, uint8_t type);
73void U2F_TRANSPORT_rx(u2f_transport_t *handle, uint8_t *buffer, uint16_t length);
74// To call once the last packet of the message being sent has reached the host.
77 uint8_t cmd,
78 const uint8_t *buffer,
79 uint16_t length,
80 uint8_t *tx_packer_buffer,
81 uint16_t tx_packet_buffer_size);
uint16_t rx_message_buffer_size
uint32_t reject_cid
uint8_t * rx_message_buffer
uint16_t rx_message_length
uint16_t rx_message_expected_sequence_number
u2f_error_t reject_error
uint16_t tx_message_sequence_number
uint16_t tx_message_offset
u2f_transport_type_t type
uint16_t tx_message_length
uint16_t rx_message_offset
const uint8_t * tx_message_buffer
u2f_error_t error
uint8_t tx_packet_length
u2f_transport_type_t
@ U2F_TRANSPORT_TYPE_BLE
@ U2F_TRANSPORT_TYPE_USB_HID
void U2F_TRANSPORT_init(u2f_transport_t *handle, uint8_t type)
void U2F_TRANSPORT_rx(u2f_transport_t *handle, uint8_t *buffer, uint16_t length)
void U2F_TRANSPORT_tx_done(u2f_transport_t *handle)
void U2F_TRANSPORT_tx(u2f_transport_t *handle, uint8_t cmd, const uint8_t *buffer, uint16_t length, uint8_t *tx_packer_buffer, uint16_t tx_packet_buffer_size)
u2f_error_t
Definition u2f_types.h:64