|
#define | APDU_HDR_LEN 5 |
|
#define | MAX_AID_LEN 16 /* Table 13.2 of TS 102 221 */ |
|
#define | OSIM_MAX_ATR_LEN 33 |
| Maximum Answer-To-Reset (ATR) size in bytes. More...
|
|
#define | msgb_apdu_dr(__x) |
|
#define | OSIM_MSGB_CB(__msgb) ((struct osim_msgb_cb *)&((__msgb)->cb[0])) |
|
#define | msgb_apdu_case(__x) OSIM_MSGB_CB(__x)->apduc |
| status word from msgb->cb More...
|
|
#define | msgb_apdu_lc(__x) OSIM_MSGB_CB(__x)->lc |
|
#define | msgb_apdu_le(__x) OSIM_MSGB_CB(__x)->le |
|
#define | msgb_apdu_sw(__x) OSIM_MSGB_CB(__x)->sw |
|
#define | msgb_apdu_h(__x) ((struct osim_apdu_cmd_hdr *)(__x)->l2h) |
| pointer to the command header of the APDU More...
|
|
#define | msgb_apdu_dc(__x) ((__x)->l2h + sizeof(struct osim_apdu_cmd_hdr)) |
|
#define | msgb_apdu_de(__x) ((__x)->l2h + sizeof(struct osim_apdu_cmd_hdr) + msgb_apdu_lc(__x)) |
|
#define | F_OPTIONAL 0x0001 |
|
#define | SFI_NONE 0xFF |
|
#define | EF(pfid, sfi, pns, pflags, pnl, ptype, smin, srec, pdec, penc) |
| Convenience macros for defining EF. More...
|
|
#define | EF_TRANSP(fid, sfi, ns, flags, smin, srec, nl, dec, enc) |
| Convenience macros for defining EF. More...
|
|
#define | EF_TRANSP_N(fid, sfi, ns, flags, smin, srec, nl) |
| Convenience macros for defining EF. More...
|
|
#define | EF_CYCLIC(fid, sfi, ns, flags, smin, srec, nl, dec, enc) |
| Convenience macros for defining EF. More...
|
|
#define | EF_CYCLIC_N(fid, sfi, ns, flags, smin, srec, nl) |
| Convenience macros for defining EF. More...
|
|
#define | EF_LIN_FIX(fid, sfi, ns, flags, smin, srec, nl, dec, enc) |
| Convenience macros for defining EF. More...
|
|
#define | EF_LIN_FIX_N(fid, sfi, ns, flags, smin, srec, nl) |
| Convenience macros for defining EF. More...
|
|
#define | EF_KEY(fid, sfi, ns, flags, smin, srec, nl, dec, enc) |
| Convenience macros for defining EF. More...
|
|
#define | EF_KEY_N(fid, sfi, ns, flags, smin, srec, nl) |
| Convenience macros for defining EF. More...
|
|
#define | OSIM_CARD_SW_LAST |
|
|
enum | osim_apdu_case {
APDU_CASE_1
,
APDU_CASE_2S
,
APDU_CASE_2E
,
APDU_CASE_3S
,
APDU_CASE_3E
,
APDU_CASE_4S
,
APDU_CASE_4E
} |
| command-response pairs cases More...
|
|
enum | osim_element_type {
ELEM_T_NONE
,
ELEM_T_BOOL
,
ELEM_T_UINT8
,
ELEM_T_UINT16
,
ELEM_T_UINT32
,
ELEM_T_STRING
,
ELEM_T_BCD
,
ELEM_T_BYTES
,
ELEM_T_GROUP
} |
|
enum | osim_element_repr {
ELEM_REPR_NONE
,
ELEM_REPR_DEC
,
ELEM_REPR_HEX
} |
|
enum | osim_file_type {
TYPE_NONE
,
TYPE_DF
,
TYPE_ADF
,
TYPE_EF
,
TYPE_EF_INT
,
TYPE_MF
} |
|
enum | osim_ef_type {
EF_TYPE_TRANSP
,
EF_TYPE_RECORD_FIXED
,
EF_TYPE_RECORD_CYCLIC
,
EF_TYPE_KEY
} |
|
enum | osim_card_sw_type {
SW_TYPE_NONE
,
SW_TYPE_STR
} |
|
enum | osim_card_sw_class {
SW_CLS_NONE
,
SW_CLS_OK
,
SW_CLS_POSTP
,
SW_CLS_WARN
,
SW_CLS_ERROR
} |
|
enum | ts102221_fcp_tag {
UICC_FCP_T_FCP = 0x62
,
UICC_FCP_T_FILE_SIZE = 0x80
,
UICC_FCP_T_TOT_F_SIZE = 0x81
,
UICC_FCP_T_FILE_DESC = 0x82
,
UICC_FCP_T_FILE_ID = 0x83
,
UICC_FCP_T_DF_NAME = 0x84
,
UICC_FCP_T_SFID = 0x88
,
UICC_FCP_T_LIFEC_STS = 0x8A
,
UICC_FCP_T_SEC_ATTR_REFEXP = 0x8B
,
UICC_FCP_T_SEC_ATTR_COMP = 0x8C
,
UICC_FCP_T_PROPRIETARY = 0xA5
,
UICC_FCP_T_SEC_ATTR_EXP = 0xAB
,
UICC_FCP_T_PIN_STS_DO = 0xC6
} |
|
enum | osim_proto {
OSIM_PROTO_T0 = 0
,
OSIM_PROTO_T1 = 1
} |
|
enum | osim_reader_driver {
OSIM_READER_DRV_PCSC = 0
,
OSIM_READER_DRV_OPENCT = 1
,
OSIM_READER_DRV_SERIAL = 2
} |
|
|
struct osim_apdu_cmd_hdr | __attribute__ ((packed)) |
|
struct osim_msgb_cb | __attribute__ ((__may_alias__)) |
|
int | osim_init (void *ctx) |
|
struct osim_file_desc * | osim_file_desc_find_name (struct osim_file_desc *parent, const char *name) |
|
struct osim_file_desc * | osim_file_desc_find_aid (struct osim_file_desc *parent, const uint8_t *aid, uint8_t aid_len) |
|
struct osim_file_desc * | osim_file_desc_find_fid (struct osim_file_desc *parent, uint16_t fid) |
|
struct osim_file_desc * | osim_file_desc_find_sfid (struct osim_file_desc *parent, uint8_t sfid) |
|
const struct osim_card_app_profile * | osim_app_profile_find_by_name (const char *name) |
| Find any registered application profile based on its name (e.g. More...
|
|
const struct osim_card_app_profile * | osim_app_profile_find_by_aid (const uint8_t *aid, uint8_t aid_len) |
| Find any registered application profile based on its AID. More...
|
|
const struct osim_card_sw * | osim_app_profile_find_sw (const struct osim_card_app_profile *ap, uint16_t sw_in) |
| Find application-specific status word within given card application profile. More...
|
|
const struct osim_card_sw * | osim_cprof_find_sw (const struct osim_card_profile *cp, uint16_t sw_in) |
| Find status word within given card profile. More...
|
|
enum osim_card_sw_class | osim_sw_class (const struct osim_chan_hdl *ch, uint16_t sw_in) |
|
char * | osim_print_sw_buf (char *buf, size_t buf_len, const struct osim_chan_hdl *ch, uint16_t sw_in) |
|
char * | osim_print_sw (const struct osim_chan_hdl *ch, uint16_t sw_in) |
|
char * | osim_print_sw_c (const void *ctx, const struct osim_chan_hdl *ch, uint16_t sw_in) |
|
struct msgb * | osim_new_apdumsg (uint8_t cla, uint8_t ins, uint8_t p1, uint8_t p2, uint16_t lc, uint16_t le) |
| Generate an APDU message and initialize APDU command header. More...
|
|
int | osim_card_hdl_add_app (struct osim_card_hdl *ch, const uint8_t *aid, uint8_t aid_len, const char *label) |
| Add an application to a given card. More...
|
|
int | osim_transceive_apdu (struct osim_chan_hdl *st, struct msgb *amsg) |
|
struct osim_reader_hdl * | osim_reader_open (enum osim_reader_driver drv, int idx, const char *name, void *ctx) |
|
struct osim_card_hdl * | osim_card_open (struct osim_reader_hdl *rh, enum osim_proto proto) |
|
int | osim_card_reset (struct osim_card_hdl *card, bool cold_reset) |
|
int | osim_card_close (struct osim_card_hdl *card) |
|
|
uint8_t | cla |
| CLASS byte. More...
|
|
uint8_t | ins |
| INSTRUCTION byte. More...
|
|
uint8_t | p1 |
| Parameter 1 byte. More...
|
|
uint8_t | p2 |
| Parameter 2 byte. More...
|
|
uint8_t | p3 |
| Parameter 3 byte, used for TPDU by T=0. More...
|
|
enum osim_apdu_case | apduc |
| command-response pair case, defining the encoding of Lc and Le More...
|
|
uint16_t | lc |
| number of bytes in the command data field Nc, which will encoded in 0, 1 or 3 bytes into Lc, depending on the case More...
|
|
uint16_t | le |
| maximum number of bytes expected in the response data field, which will encoded in 0, 1, 2 or 3 bytes into Le, depending on the case More...
|
|
uint16_t | sw |
| status word, composed of SW1 and SW2 bytes More...
|
|
struct osim_file_ops | __attribute__ |
|
const struct tlv_definition | ts102221_fcp_tlv_def |
|
const struct value_string | ts102221_fcp_vals [14] |
|
Routines for helping with SIM (ISO/IEC 7816-4 more generally) communication.
struct msgb * osim_new_apdumsg |
( |
uint8_t |
cla, |
|
|
uint8_t |
ins, |
|
|
uint8_t |
p1, |
|
|
uint8_t |
p2, |
|
|
uint16_t |
lc, |
|
|
uint16_t |
le |
|
) |
| |
Generate an APDU message and initialize APDU command header.
- Parameters
-
[in] | cla | CLASS byte |
[in] | ins | INSTRUCTION byte |
[in] | p1 | Parameter 1 byte |
[in] | p2 | Parameter 2 byte |
[in] | lc | number of bytes in the command data field Nc, which will encoded in 0, 1 or 3 bytes into Lc |
[in] | le | maximum number of bytes expected in the response data field, which will encoded in 0, 1, 2 or 3 bytes into Le |
- Returns
- an APDU message generated using provided APDU parameters
This function generates an APDU message, as defined in ISO/IEC 7816-4:2005(E) ยง5.1. The APDU command header, command and response fields lengths are initialized using the parameters. The APDU case is determined by the command and response fields lengths.
References APDU_CASE_1, APDU_CASE_2E, APDU_CASE_2S, APDU_CASE_3E, APDU_CASE_3S, APDU_CASE_4E, APDU_CASE_4S, cla, osim_apdu_cmd_hdr::cla, ins, osim_apdu_cmd_hdr::ins, msgb::l2h, lc, le, msgb_alloc(), msgb_apdu_case, msgb_apdu_lc, msgb_apdu_le, msgb_put(), p1, osim_apdu_cmd_hdr::p1, p2, and osim_apdu_cmd_hdr::p2.