Files
Momentum-Firmware/applications/debug/ccid_test/iso7816/iso7816_t0_apdu.h
Filipe Paz Rodrigues 53cf700521 CCID App: Refactor (#3808)
- Move iso7816 related code to its own folder
- Refactor Iso7816Callback into Iso7816Handler
- Created new file for CCID commands
- Renamed variables according to standard

Co-authored-by: あく <alleteam@gmail.com>
2024-08-01 06:44:04 +09:00

42 lines
1.0 KiB
C

#pragma once
#include <stdint.h>
#include "iso7816_atr.h"
#include "core/common_defines.h"
#define ISO7816_READ_COMMAND_APDU_OK 0
#define ISO7816_READ_COMMAND_APDU_ERROR_WRONG_LE 1
#define ISO7816_READ_COMMAND_APDU_ERROR_WRONG_LENGTH 2
typedef struct {
//header
uint8_t CLA;
uint8_t INS;
uint8_t P1;
uint8_t P2;
//body
uint16_t Lc; //data length
uint16_t Le; //maximum response data length expected by client
//Le can have value of 0x00, which actually meand 0x100 = 256
bool LePresent;
uint8_t Data[0];
} FURI_PACKED ISO7816_Command_APDU;
typedef struct {
uint8_t SW1;
uint8_t SW2;
uint16_t DataLen;
uint8_t Data[0];
} FURI_PACKED ISO7816_Response_APDU;
uint8_t iso7816_read_command_apdu(
ISO7816_Command_APDU* command,
const uint8_t* pc_to_reader_datablock,
uint32_t pc_to_reader_datablock_len);
void iso7816_write_response_apdu(
const ISO7816_Response_APDU* response,
uint8_t* reader_to_pc_datablock,
uint32_t* reader_to_pc_datablock_len);