API change
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2011-05-16 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* src/openpgp.c (cmd_select_file): Don't use write_res_apdu.
|
||||||
|
(set_res_apdu): Rename from write_res_apdu. Just SW1 and SW2.
|
||||||
|
|
||||||
2011-05-13 NIIBE Yutaka <gniibe@fsij.org>
|
2011-05-13 NIIBE Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* Version 0.12.
|
* Version 0.12.
|
||||||
|
|||||||
@@ -90,8 +90,7 @@ extern void ac_reset_admin (void);
|
|||||||
extern void ac_fini (void);
|
extern void ac_fini (void);
|
||||||
|
|
||||||
|
|
||||||
extern void write_res_apdu (const uint8_t *p, int len,
|
extern void set_res_apdu (uint8_t sw1, uint8_t sw2);
|
||||||
uint8_t sw1, uint8_t sw2);
|
|
||||||
extern uint16_t data_objects_number_of_bytes;
|
extern uint16_t data_objects_number_of_bytes;
|
||||||
|
|
||||||
extern void gpg_data_scan (const uint8_t *p);
|
extern void gpg_data_scan (const uint8_t *p);
|
||||||
|
|||||||
@@ -62,13 +62,11 @@ select_file_TOP_result[] __attribute__ ((aligned (1))) = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
write_res_apdu (const uint8_t *p, int len, uint8_t sw1, uint8_t sw2)
|
set_res_apdu (uint8_t sw1, uint8_t sw2)
|
||||||
{
|
{
|
||||||
res_APDU_size = 2 + len;
|
res_APDU_size = 2;
|
||||||
if (len)
|
res_APDU[0] = sw1;
|
||||||
memcpy (res_APDU, p, len);
|
res_APDU[1] = sw2;
|
||||||
res_APDU[len] = sw1;
|
|
||||||
res_APDU[len+1] = sw2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FILE_NONE 0
|
#define FILE_NONE 0
|
||||||
@@ -678,10 +676,14 @@ cmd_select_file (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
write_res_apdu (select_file_TOP_result,
|
int len = sizeof (select_file_TOP_result);
|
||||||
sizeof (select_file_TOP_result), 0x90, 0x00);
|
|
||||||
|
res_APDU_size = 2 + len;
|
||||||
|
memcpy (res_APDU, select_file_TOP_result, len);
|
||||||
res_APDU[2] = (data_objects_number_of_bytes & 0xff);
|
res_APDU[2] = (data_objects_number_of_bytes & 0xff);
|
||||||
res_APDU[3] = (data_objects_number_of_bytes >> 8);
|
res_APDU[3] = (data_objects_number_of_bytes >> 8);
|
||||||
|
res_APDU[len] = 0x90;
|
||||||
|
res_APDU[len+1] = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
file_selection = FILE_MF;
|
file_selection = FILE_MF;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#define GPG_MEMORY_FAILURE() write_res_apdu (NULL, 0, 0x65, 0x81)
|
#define GPG_MEMORY_FAILURE() set_res_apdu (0x65, 0x81)
|
||||||
#define GPG_SECURITY_FAILURE() write_res_apdu (NULL, 0, 0x69, 0x82)
|
#define GPG_SECURITY_FAILURE() set_res_apdu (0x69, 0x82)
|
||||||
#define GPG_SECURITY_AUTH_BLOCKED() write_res_apdu (NULL, 0, 0x69, 0x83)
|
#define GPG_SECURITY_AUTH_BLOCKED() set_res_apdu (0x69, 0x83)
|
||||||
#define GPG_COMMAND_NOT_ALLOWED() write_res_apdu (NULL, 0, 0x69, 0x86)
|
#define GPG_COMMAND_NOT_ALLOWED() set_res_apdu (0x69, 0x86)
|
||||||
#define GPG_NO_FILE() write_res_apdu (NULL, 0, 0x6a, 0x82)
|
#define GPG_NO_FILE() set_res_apdu (0x6a, 0x82)
|
||||||
#define GPG_NO_RECORD() write_res_apdu (NULL, 0, 0x6a, 0x88)
|
#define GPG_NO_RECORD() set_res_apdu (0x6a, 0x88)
|
||||||
#define GPG_BAD_P0_P1() write_res_apdu (NULL, 0, 0x6b, 0x00)
|
#define GPG_BAD_P0_P1() set_res_apdu (0x6b, 0x00)
|
||||||
#define GPG_NO_INS() write_res_apdu (NULL, 0, 0x6d, 0x00)
|
#define GPG_NO_INS() set_res_apdu (0x6d, 0x00)
|
||||||
#define GPG_ERROR() write_res_apdu (NULL, 0, 0x6f, 0x00)
|
#define GPG_ERROR() set_res_apdu (0x6f, 0x00)
|
||||||
#define GPG_SUCCESS() write_res_apdu (NULL, 0, 0x90, 0x00)
|
#define GPG_SUCCESS() set_res_apdu (0x90, 0x00)
|
||||||
|
|||||||
Reference in New Issue
Block a user