mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-01-17 09:28:05 +00:00
- Adding the rest of Gnuk USB/CCID methods.
- It runs the openpgp thread in the other core (core1) and leaves the main program/ccid/usb methods running in the core 0. - At this moment it does not call openpgp_thread. - Compiles but it needs further debug
This commit is contained in:
parent
3169139d3d
commit
b217740e58
4 changed files with 1326 additions and 91 deletions
|
|
@ -14,10 +14,11 @@ add_executable(hsm2040)
|
|||
target_sources(hsm2040 PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}/hsm2040.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/usb_descriptors.c
|
||||
# ${CMAKE_CURRENT_LIST_DIR}/openpgp-do.c
|
||||
)
|
||||
|
||||
target_include_directories(hsm2040 PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
pico_add_extra_outputs(hsm2040)
|
||||
target_link_libraries(hsm2040 PRIVATE pico_stdlib tinyusb_device tinyusb_board)
|
||||
target_link_libraries(hsm2040 PRIVATE pico_stdlib tinyusb_device tinyusb_board pico_multicore)
|
||||
15
ccid.h
15
ccid.h
|
|
@ -20,6 +20,21 @@ struct apdu {
|
|||
|
||||
extern struct apdu apdu;
|
||||
|
||||
/* CCID thread */
|
||||
#define EV_CARD_CHANGE 1
|
||||
#define EV_TX_FINISHED 2 /* CCID Tx finished */
|
||||
#define EV_EXEC_ACK_REQUIRED 4 /* OpenPGPcard Execution ACK required */
|
||||
#define EV_EXEC_FINISHED 8 /* OpenPGPcard Execution finished */
|
||||
#define EV_RX_DATA_READY 16 /* USB Rx data available */
|
||||
|
||||
/* OpenPGPcard thread */
|
||||
#define EV_MODIFY_CMD_AVAILABLE 1
|
||||
#define EV_VERIFY_CMD_AVAILABLE 2
|
||||
#define EV_CMD_AVAILABLE 4
|
||||
#define EV_EXIT 8
|
||||
#define EV_PINPAD_INPUT_DONE 16
|
||||
|
||||
|
||||
enum ccid_state {
|
||||
CCID_STATE_NOCARD, /* No card available */
|
||||
CCID_STATE_START, /* Initial */
|
||||
|
|
|
|||
29
hsm2040.h
29
hsm2040.h
|
|
@ -11,4 +11,33 @@
|
|||
|
||||
#define USB_REQ_CCID 0xA1
|
||||
|
||||
#define USB_LL_BUF_SIZE 64
|
||||
|
||||
extern const uint8_t historical_bytes[];
|
||||
|
||||
#define DEBUG_INFO(s) TU_LOG2(s)
|
||||
|
||||
static void put_hex (uint8_t nibble)
|
||||
{
|
||||
uint8_t c;
|
||||
|
||||
if (nibble < 0x0a)
|
||||
c = '0' + nibble;
|
||||
else
|
||||
c = 'a' + nibble - 0x0a;
|
||||
|
||||
TU_LOG3("%c",c);
|
||||
}
|
||||
|
||||
void
|
||||
put_byte (uint8_t b)
|
||||
{
|
||||
put_hex (b >> 4);
|
||||
put_hex (b &0x0f);
|
||||
TU_LOG3("\r\n");
|
||||
}
|
||||
|
||||
#define DEBUG_BYTE(b) put_byte(b)
|
||||
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Reference in a new issue