src/emv-internal.h File Reference

#include <openssl/sha.h>
#include <openssl/rsa.h>
#include <openssl/engine.h>
#include <gang.h>
#include <mpool.h>
Include dependency graph for emv-internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _emv_tag
struct  _emv_data
struct  _emv_db
struct  _emv_app
struct  _emv
struct  dol_tag

Defines

#define EMV_PIN_BLOCK_LEN   8
#define EMV_ERR_TYPE_SHIFT   30
#define EMV_ERR_CODE_MASK   ((1 << EMV_ERR_TYPE_SHIFT) - 1)
#define EMV_DATA_SDA   (1<<0)
#define EMV_DATA_DDA   (1<<1)
#define EMV_DATA_ATOMIC   (1<<15)
#define EMV_DATA_DOL   (1<<14)
#define EMV_DATA_TYPE_MASK   ((1<<14)-1)
#define DOL_NUM_TAGS(x)   (sizeof(x)/sizeof(struct dol_tag))

Typedefs

typedef uint8_t emv_pb_t [EMV_PIN_BLOCK_LEN]

Functions

static int emv_data_atomic (struct _emv_data *d)
static int emv_data_composite (struct _emv_data *d)
_private uint8_t _emv_sw1 (emv_t e)
_private uint8_t _emv_sw2 (emv_t e)
_private int _emv_pin2pb (const char *pin, uint8_t *pb)
_private void _emv_free_applist (emv_t e)
_private void _emv_init_applist (emv_t e)
_private int _emv_app_init (emv_t e, const uint8_t *aid, size_t aid_len)
_private int _emv_read_app_data (struct _emv *e)
_private struct _emv_data_emv_retrieve_data (emv_t, uint16_t id)
_private uint8_t * _emv_construct_dol (emv_dol_cb_t cbfn, const uint8_t *ptr, size_t len, size_t *ret_len, void *priv)
_private int _emv_read_record (emv_t e, uint8_t sfi, uint8_t record)
_private int _emv_select (emv_t e, const uint8_t *name, size_t nlen)
_private int _emv_select_next (emv_t e, const uint8_t *name, size_t nlen)
_private int _emv_verify (emv_t e, uint8_t fmt, const uint8_t *p, uint8_t plen)
_private int _emv_get_data (emv_t e, uint8_t p1, uint8_t p2)
_private int _emv_get_proc_opts (emv_t e, const uint8_t *pdol, uint8_t len)
_private int _emv_generate_ac (emv_t e, uint8_t ref, const uint8_t *data, uint8_t len)
_private int _emv_int_authenticate (emv_t e, const uint8_t *data, uint8_t len)
_private void _emv_sys_error (struct _emv *e)
_private void _emv_ccid_error (struct _emv *e)
_private void _emv_icc_error (struct _emv *e)
_private void _emv_error (struct _emv *e, unsigned int code)
_private void _emv_success (struct _emv *e)
_private int _emsa_pss_decode (const uint8_t *msg, size_t msg_len, const uint8_t *em, size_t em_len)

Define Documentation

#define DOL_NUM_TAGS (  )     (sizeof(x)/sizeof(struct dol_tag))

Definition at line 106 of file emv-internal.h.

#define EMV_DATA_ATOMIC   (1<<15)

Definition at line 26 of file emv-internal.h.

Referenced by emv_data_atomic(), and emv_data_composite().

#define EMV_DATA_DDA   (1<<1)

Definition at line 24 of file emv-internal.h.

#define EMV_DATA_DOL   (1<<14)

Definition at line 27 of file emv-internal.h.

#define EMV_DATA_SDA   (1<<0)

Definition at line 23 of file emv-internal.h.

Referenced by decode_record(), and emv_data_sda().

#define EMV_DATA_TYPE_MASK   ((1<<14)-1)

Definition at line 28 of file emv-internal.h.

Referenced by emv_data_int(), and emv_data_type().

#define EMV_ERR_CODE_MASK   ((1 << EMV_ERR_TYPE_SHIFT) - 1)

Definition at line 19 of file emv-internal.h.

Referenced by _emv_error(), _emv_sys_error(), emv_error_additional(), and emv_error_string().

#define EMV_ERR_TYPE_SHIFT   30
#define EMV_PIN_BLOCK_LEN   8

Definition at line 9 of file emv-internal.h.

Referenced by _emv_pin2pb().


Typedef Documentation

typedef uint8_t emv_pb_t[EMV_PIN_BLOCK_LEN]

Definition at line 21 of file emv-internal.h.


Function Documentation

_private int _emsa_pss_decode ( const uint8_t *  msg,
size_t  msg_len,
const uint8_t *  em,
size_t  em_len 
)

Definition at line 25 of file emv.c.

Referenced by check_icc_cert(), check_pk_cert(), and check_ssa().

Here is the caller graph for this function:

_private int _emv_app_init ( emv_t  e,
const uint8_t *  aid,
size_t  aid_len 
)
_private void _emv_ccid_error ( struct _emv e  ) 

Definition at line 20 of file emv_err.c.

References _emv::e_err, EMV_ERR_CCID, and EMV_ERR_TYPE_SHIFT.

Referenced by _emv_generate_ac(), _emv_get_data(), _emv_get_proc_opts(), _emv_int_authenticate(), _emv_read_record(), _emv_verify(), and do_sel().

Here is the caller graph for this function:

_private uint8_t* _emv_construct_dol ( emv_dol_cb_t  cbfn,
const uint8_t *  ptr,
size_t  len,
size_t *  ret_len,
void *  priv 
)

Definition at line 157 of file emv.c.

References construct_dol().

Referenced by verify_dynamic_sig().

Here is the call graph for this function:

Here is the caller graph for this function:

_private void _emv_error ( struct _emv e,
unsigned int  code 
)
_private void _emv_free_applist ( emv_t  e  ) 

Definition at line 97 of file emv_appsel.c.

References _emv_app::a_list, _emv::e_apps, list_del(), and list_for_each_entry_safe.

Referenced by do_emv_fini().

Here is the call graph for this function:

Here is the caller graph for this function:

_private int _emv_generate_ac ( emv_t  e,
uint8_t  ref,
const uint8_t *  data,
uint8_t  len 
)

Definition at line 220 of file emv_apdu.c.

References _emv_ccid_error(), _emv_icc_error(), chipcard_transact(), _emv::e_dev, _emv::e_xfr, xfr_reset(), xfr_rx_sw1(), xfr_rx_sw2(), xfr_tx_buf(), and xfr_tx_byte().

Referenced by emv_generate_ac().

Here is the call graph for this function:

Here is the caller graph for this function:

_private int _emv_get_data ( emv_t  e,
uint8_t  p1,
uint8_t  p2 
)

Definition at line 111 of file emv_apdu.c.

References _emv_ccid_error(), _emv_icc_error(), chipcard_transact(), _emv::e_dev, _emv::e_xfr, xfr_reset(), xfr_rx_sw1(), xfr_rx_sw2(), and xfr_tx_byte().

Referenced by atc(), and ptc().

Here is the call graph for this function:

Here is the caller graph for this function:

_private int _emv_get_proc_opts ( emv_t  e,
const uint8_t *  pdol,
uint8_t  len 
)

Definition at line 176 of file emv_apdu.c.

References _emv_ccid_error(), _emv_icc_error(), chipcard_transact(), _emv::e_dev, _emv::e_xfr, xfr_reset(), xfr_rx_sw1(), xfr_rx_sw2(), xfr_tx_buf(), and xfr_tx_byte().

Referenced by get_aip().

Here is the call graph for this function:

Here is the caller graph for this function:

_private void _emv_icc_error ( struct _emv e  ) 

Definition at line 25 of file emv_err.c.

References _emv_sw1(), _emv_sw2(), _emv::e_err, EMV_ERR_ICC, and EMV_ERR_TYPE_SHIFT.

Referenced by _emv_generate_ac(), _emv_get_data(), _emv_get_proc_opts(), _emv_int_authenticate(), _emv_read_record(), _emv_verify(), and do_sel().

Here is the call graph for this function:

Here is the caller graph for this function:

_private void _emv_init_applist ( emv_t  e  ) 
_private int _emv_int_authenticate ( emv_t  e,
const uint8_t *  data,
uint8_t  len 
)

Definition at line 265 of file emv_apdu.c.

References _emv_ccid_error(), _emv_icc_error(), chipcard_transact(), _emv::e_dev, _emv::e_xfr, xfr_reset(), xfr_rx_sw1(), xfr_rx_sw2(), xfr_tx_buf(), and xfr_tx_byte().

Referenced by verify_dynamic_sig().

Here is the call graph for this function:

Here is the caller graph for this function:

_private int _emv_pin2pb ( const char *  pin,
uint8_t *  pb 
)

Referenced by emv_cvm_pin().

Here is the caller graph for this function:

_private int _emv_read_app_data ( struct _emv e  ) 
_private int _emv_read_record ( emv_t  e,
uint8_t  sfi,
uint8_t  record 
)

Definition at line 68 of file emv_apdu.c.

References _emv_ccid_error(), _emv_icc_error(), chipcard_transact(), _emv::e_dev, _emv::e_xfr, xfr_reset(), xfr_rx_sw1(), xfr_rx_sw2(), and xfr_tx_byte().

Referenced by emv_appsel_pse(), and read_sfi().

Here is the call graph for this function:

Here is the caller graph for this function:

_private struct _emv_data* _emv_retrieve_data ( emv_t  ,
uint16_t  id 
) [read]

Definition at line 172 of file emv_data.c.

References _emv_db::db_elem, _emv_db::db_nmemb, _emv::e_db, and find_data().

Referenced by get_required_data().

Here is the call graph for this function:

Here is the caller graph for this function:

_private int _emv_select ( emv_t  e,
const uint8_t *  name,
size_t  nlen 
)

Definition at line 58 of file emv_apdu.c.

References do_sel().

Referenced by emv_app_select_aid(), emv_app_select_pse(), and emv_appsel_pse().

Here is the call graph for this function:

Here is the caller graph for this function:

_private int _emv_select_next ( emv_t  e,
const uint8_t *  name,
size_t  nlen 
)

Definition at line 63 of file emv_apdu.c.

References do_sel().

Referenced by emv_app_select_aid_next().

Here is the call graph for this function:

Here is the caller graph for this function:

_private void _emv_success ( struct _emv e  ) 

Definition at line 43 of file emv_err.c.

References _emv::e_err.

Referenced by emv_app_init(), emv_appsel_pse(), and emv_read_app_data().

Here is the caller graph for this function:

_private uint8_t _emv_sw1 ( emv_t  e  ) 

Definition at line 15 of file emv.c.

References _emv::e_xfr, and xfr_rx_sw1().

Referenced by _emv_icc_error(), and emv_cvm_pin().

Here is the call graph for this function:

Here is the caller graph for this function:

_private uint8_t _emv_sw2 ( emv_t  e  ) 

Definition at line 20 of file emv.c.

References _emv::e_xfr, and xfr_rx_sw2().

Referenced by _emv_icc_error().

Here is the call graph for this function:

Here is the caller graph for this function:

_private void _emv_sys_error ( struct _emv e  ) 

Definition at line 14 of file emv_err.c.

References _emv::e_err, EMV_ERR_CODE_MASK, EMV_ERR_SYSTEM, and EMV_ERR_TYPE_SHIFT.

Referenced by check_icc_cert(), check_pk_cert(), check_ssa(), composite(), decode_record(), emv_read_app_data(), make_icc_pk(), and make_issuer_pk().

Here is the caller graph for this function:

_private int _emv_verify ( emv_t  e,
uint8_t  fmt,
const uint8_t *  p,
uint8_t  plen 
)

Definition at line 153 of file emv_apdu.c.

References _emv_ccid_error(), _emv_icc_error(), chipcard_transact(), _emv::e_dev, _emv::e_xfr, xfr_reset(), xfr_rx_sw1(), xfr_tx_buf(), and xfr_tx_byte().

Referenced by emv_cvm_pin().

Here is the call graph for this function:

Here is the caller graph for this function:

static int emv_data_atomic ( struct _emv_data d  )  [inline, static]

Definition at line 46 of file emv-internal.h.

References _emv_data::d_tag, EMV_DATA_ATOMIC, and _emv_tag::t_type.

static int emv_data_composite ( struct _emv_data d  )  [inline, static]

Definition at line 50 of file emv-internal.h.

References _emv_data::d_tag, EMV_DATA_ATOMIC, and _emv_tag::t_type.

Referenced by add_elements(), composite(), and count_elements().

Here is the caller graph for this function:

Generated on Sun Jan 2 08:35:11 2011 for ccid-utils by  doxygen 1.6.3