|
Packit |
cfa437 |
/*
|
|
Packit |
cfa437 |
* Implement the 7816 portion of the card spec
|
|
Packit |
cfa437 |
*
|
|
Packit |
cfa437 |
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
|
Packit |
cfa437 |
* See the COPYING file in the top-level directory.
|
|
Packit |
cfa437 |
*/
|
|
Packit |
cfa437 |
#ifndef CARD_7816_H
|
|
Packit |
cfa437 |
#define CARD_7816_H 1
|
|
Packit |
cfa437 |
|
|
Packit |
cfa437 |
#include "card_7816t.h"
|
|
Packit |
cfa437 |
#include "vcardt.h"
|
|
Packit |
cfa437 |
|
|
Packit |
cfa437 |
/*
|
|
Packit |
cfa437 |
* constructors for VCardResponse's
|
|
Packit |
cfa437 |
*/
|
|
Packit |
cfa437 |
/* response from a return buffer and a status */
|
|
Packit |
cfa437 |
VCardResponse *vcard_response_new(VCard *card, unsigned char *buf, int len,
|
|
Packit |
cfa437 |
int Le, vcard_7816_status_t status);
|
|
Packit |
cfa437 |
/* response from a return buffer and status bytes */
|
|
Packit |
cfa437 |
VCardResponse *vcard_response_new_bytes(VCard *card, unsigned char *buf,
|
|
Packit |
cfa437 |
int len, int Le,
|
|
Packit |
cfa437 |
unsigned char sw1, unsigned char sw2);
|
|
Packit |
cfa437 |
/* response from just status bytes */
|
|
Packit |
cfa437 |
VCardResponse *vcard_response_new_status_bytes(unsigned char sw1,
|
|
Packit |
cfa437 |
unsigned char sw2);
|
|
Packit |
cfa437 |
/* response from just status: NOTE this cannot fail, it will always return a
|
|
Packit |
cfa437 |
* valid response, if it can't allocate memory, the response will be
|
|
Packit |
cfa437 |
* VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE */
|
|
Packit |
cfa437 |
VCardResponse *vcard_make_response(vcard_7816_status_t status);
|
|
Packit |
cfa437 |
|
|
Packit |
cfa437 |
/* create a raw response (status has already been encoded */
|
|
Packit |
cfa437 |
VCardResponse *vcard_response_new_data(unsigned char *buf, int len);
|
|
Packit |
cfa437 |
|
|
Packit |
cfa437 |
void vcard_response_set_status_bytes(VCardResponse *response,
|
|
Packit |
cfa437 |
unsigned char sw1, unsigned char sw2);
|
|
Packit |
cfa437 |
|
|
Packit |
cfa437 |
/*
|
|
Packit |
cfa437 |
* destructor for VCardResponse.
|
|
Packit |
cfa437 |
* Can be called with a NULL response
|
|
Packit |
cfa437 |
*/
|
|
Packit |
cfa437 |
void vcard_response_delete(VCardResponse *response);
|
|
Packit |
cfa437 |
|
|
Packit |
cfa437 |
/*
|
|
Packit |
cfa437 |
* constructor for VCardAPDU
|
|
Packit |
cfa437 |
*/
|
|
Packit |
cfa437 |
VCardAPDU *vcard_apdu_new(unsigned char *raw_apdu, int len,
|
|
Packit |
cfa437 |
unsigned short *status);
|
|
Packit |
cfa437 |
|
|
Packit |
cfa437 |
/*
|
|
Packit |
cfa437 |
* destructor for VCardAPDU
|
|
Packit |
cfa437 |
* Can be called with a NULL apdu
|
|
Packit |
cfa437 |
*/
|
|
Packit |
cfa437 |
void vcard_apdu_delete(VCardAPDU *apdu);
|
|
Packit |
cfa437 |
|
|
Packit |
cfa437 |
/*
|
|
Packit |
cfa437 |
* APDU processing starts here. This routes the card processing stuff to the
|
|
Packit |
cfa437 |
* right location. Always returns a valid response.
|
|
Packit |
cfa437 |
*/
|
|
Packit |
cfa437 |
VCardStatus vcard_process_apdu(VCard *card, VCardAPDU *apdu,
|
|
Packit |
cfa437 |
VCardResponse **response);
|
|
Packit |
cfa437 |
|
|
Packit |
cfa437 |
#endif
|