root / libcacard / card_7816.h @ 2542bfd5
History | View | Annotate | Download (2 kB)
1 | 111a38b0 | Robert Relyea | /*
|
---|---|---|---|
2 | 111a38b0 | Robert Relyea | * Implement the 7816 portion of the card spec
|
3 | 111a38b0 | Robert Relyea | *
|
4 | 111a38b0 | Robert Relyea | * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
5 | 111a38b0 | Robert Relyea | * See the COPYING.LIB file in the top-level directory.
|
6 | 111a38b0 | Robert Relyea | */
|
7 | 111a38b0 | Robert Relyea | #ifndef CARD_7816_H
|
8 | 111a38b0 | Robert Relyea | #define CARD_7816_H 1 |
9 | 111a38b0 | Robert Relyea | |
10 | 111a38b0 | Robert Relyea | #include "card_7816t.h" |
11 | 111a38b0 | Robert Relyea | #include "vcardt.h" |
12 | 111a38b0 | Robert Relyea | |
13 | 111a38b0 | Robert Relyea | /*
|
14 | 111a38b0 | Robert Relyea | * constructors for VCardResponse's
|
15 | 111a38b0 | Robert Relyea | */
|
16 | 111a38b0 | Robert Relyea | /* response from a return buffer and a status */
|
17 | 111a38b0 | Robert Relyea | VCardResponse *vcard_response_new(VCard *card, unsigned char *buf, int len, |
18 | 111a38b0 | Robert Relyea | int Le, vcard_7816_status_t status);
|
19 | 111a38b0 | Robert Relyea | /* response from a return buffer and status bytes */
|
20 | 111a38b0 | Robert Relyea | VCardResponse *vcard_response_new_bytes(VCard *card, unsigned char *buf, |
21 | 111a38b0 | Robert Relyea | int len, int Le, |
22 | 111a38b0 | Robert Relyea | unsigned char sw1, unsigned char sw2); |
23 | 111a38b0 | Robert Relyea | /* response from just status bytes */
|
24 | 111a38b0 | Robert Relyea | VCardResponse *vcard_response_new_status_bytes(unsigned char sw1, |
25 | 111a38b0 | Robert Relyea | unsigned char sw2); |
26 | 111a38b0 | Robert Relyea | /* response from just status: NOTE this cannot fail, it will alwyas return a
|
27 | 111a38b0 | Robert Relyea | * valid response, if it can't allocate memory, the response will be
|
28 | 111a38b0 | Robert Relyea | * VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE */
|
29 | 111a38b0 | Robert Relyea | VCardResponse *vcard_make_response(vcard_7816_status_t status); |
30 | 111a38b0 | Robert Relyea | |
31 | 111a38b0 | Robert Relyea | /* create a raw response (status has already been encoded */
|
32 | 111a38b0 | Robert Relyea | VCardResponse *vcard_response_new_data(unsigned char *buf, int len); |
33 | 111a38b0 | Robert Relyea | |
34 | 111a38b0 | Robert Relyea | |
35 | 111a38b0 | Robert Relyea | |
36 | 111a38b0 | Robert Relyea | |
37 | 111a38b0 | Robert Relyea | /*
|
38 | 111a38b0 | Robert Relyea | * destructor for VCardResponse.
|
39 | 111a38b0 | Robert Relyea | * Can be called with a NULL response
|
40 | 111a38b0 | Robert Relyea | */
|
41 | 111a38b0 | Robert Relyea | void vcard_response_delete(VCardResponse *response);
|
42 | 111a38b0 | Robert Relyea | |
43 | 111a38b0 | Robert Relyea | /*
|
44 | 111a38b0 | Robert Relyea | * constructor for VCardAPDU
|
45 | 111a38b0 | Robert Relyea | */
|
46 | 111a38b0 | Robert Relyea | VCardAPDU *vcard_apdu_new(unsigned char *raw_apdu, int len, |
47 | 111a38b0 | Robert Relyea | unsigned short *status); |
48 | 111a38b0 | Robert Relyea | |
49 | 111a38b0 | Robert Relyea | /*
|
50 | 111a38b0 | Robert Relyea | * destructor for VCardAPDU
|
51 | 111a38b0 | Robert Relyea | * Can be called with a NULL apdu
|
52 | 111a38b0 | Robert Relyea | */
|
53 | 111a38b0 | Robert Relyea | void vcard_apdu_delete(VCardAPDU *apdu);
|
54 | 111a38b0 | Robert Relyea | |
55 | 111a38b0 | Robert Relyea | /*
|
56 | 111a38b0 | Robert Relyea | * APDU processing starts here. This routes the card processing stuff to the
|
57 | 111a38b0 | Robert Relyea | * right location. Always returns a valid response.
|
58 | 111a38b0 | Robert Relyea | */
|
59 | 111a38b0 | Robert Relyea | VCardStatus vcard_process_apdu(VCard *card, VCardAPDU *apdu, |
60 | 111a38b0 | Robert Relyea | VCardResponse **response); |
61 | 111a38b0 | Robert Relyea | |
62 | 111a38b0 | Robert Relyea | #endif |