diff options
author | Arron Wang <arron.wang@intel.com> | 2014-05-21 01:09:39 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-05-21 01:09:39 +0200 |
commit | 993ded3f9d2b056044b083b75567f9c8896e3fb0 (patch) | |
tree | eff0b2ebf03a43cab72cf291703b71b5c2aed8b5 | |
parent | a95b1cf0781cd8a9c494299365c8e7165a39225c (diff) | |
download | neard-993ded3f9d2b056044b083b75567f9c8896e3fb0.tar.gz neard-993ded3f9d2b056044b083b75567f9c8896e3fb0.tar.bz2 neard-993ded3f9d2b056044b083b75567f9c8896e3fb0.zip |
ace: Add length option for get refresh tag operation
In command INS_GET_GP_DATA, when try to get the refresh tag
value, the return value is not null, then we need to set the
resp_lenght to 0. Also the response value for get refresh tag
operation is (tag, length, value), we missed the length option
in current code.
-rw-r--r-- | se/ace.c | 9 | ||||
-rw-r--r-- | se/apdu.c | 2 |
2 files changed, 7 insertions, 4 deletions
@@ -54,6 +54,7 @@ uint8_t gp_aid[] = {0xA0, 0x00, 0x00, 0x01, #define APDU_STATUS_LEN 2 #define GET_ALL_DATA_CMD_LEN 2 #define GET_REFRESH_DATA_CMD_LEN 2 +#define GET_REFRESH_DATA_TAG_LEN 1 #define GET_REFRESH_TAG_LEN 8 /* if ((APDU_header & rule->mask) == rule->header) then APDU is allowed */ @@ -551,10 +552,11 @@ static void get_refresh_gp_data_cb(void *context, if (err) return; - if (apdu_length != GET_REFRESH_DATA_CMD_LEN + GET_REFRESH_TAG_LEN + APDU_STATUS_LEN) + if (apdu_length != GET_REFRESH_DATA_CMD_LEN + GET_REFRESH_DATA_TAG_LEN + + GET_REFRESH_TAG_LEN + APDU_STATUS_LEN) return; - if (apdu[0] != 0xDF || apdu[1] != 0x20) + if (apdu[0] != 0xDF || apdu[1] != 0x20 || apdu[2] != 0x08) return; ace = g_try_malloc0(sizeof(struct seel_ace)); @@ -563,7 +565,8 @@ static void get_refresh_gp_data_cb(void *context, ace->se = se; - memcpy(ace->rules_tag, apdu + GET_REFRESH_DATA_CMD_LEN, GET_REFRESH_TAG_LEN); + memcpy(ace->rules_tag, apdu + GET_REFRESH_DATA_CMD_LEN + + GET_REFRESH_DATA_TAG_LEN, GET_REFRESH_TAG_LEN); get_all_gp_data = __seel_apdu_get_all_gp_data(); if (!get_all_gp_data) @@ -229,7 +229,7 @@ struct seel_apdu *__seel_apdu_get_refresh_gp_data(void) DBG(""); return alloc_apdu(CLA_PROPRIETARY_CMD, 0, INS_GET_GP_DATA, - 0xDF, 0x20, 0, NULL, -1); + 0xDF, 0x20, 0, NULL, 0xB); } static int apdu_trailer_status(struct iso7816_apdu_resp *trailer) |