From: Yang Gu <yang.gu@intel.com>
To: ofono@ofono.org
Subject: [PATCH 20/27] stkutil: Add perform card apdu command parser
Date: Thu, 13 May 2010 18:48:37 +0800 [thread overview]
Message-ID: <1273747724-28019-20-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1273747724-28019-1-git-send-email-yang.gu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 5266 bytes --]
---
src/stkutil.c | 27 ++++++++++++++++++++++
src/stkutil.h | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+), 0 deletions(-)
diff --git a/src/stkutil.c b/src/stkutil.c
index 01cdeef..8ba4b2d 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2644,6 +2644,30 @@ static gboolean parse_setup_event_list(struct stk_command *command,
return TRUE;
}
+static gboolean parse_perform_card_apdu(struct stk_command *command,
+ struct comprehension_tlv_iter *iter)
+{
+ struct stk_command_perform_card_apdu *obj = &command->perform_card_apdu;
+ gboolean ret;
+
+ if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
+ return FALSE;
+
+ if ((command->dst < STK_DEVICE_IDENTITY_TYPE_CARD_READER_0) ||
+ (command->dst > STK_DEVICE_IDENTITY_TYPE_CARD_READER_7))
+ return FALSE;
+
+ ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_C_APDU,
+ DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM,
+ &obj->c_apdu,
+ STK_DATA_OBJECT_TYPE_INVALID);
+
+ if (ret == FALSE)
+ return FALSE;
+
+ return TRUE;
+}
+
struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
unsigned int len)
{
@@ -2744,6 +2768,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
case STK_COMMAND_TYPE_SETUP_EVENT_LIST:
ok = parse_setup_event_list(command, &iter);
break;
+ case STK_COMMAND_TYPE_PERFORM_CARD_APDU:
+ ok = parse_perform_card_apdu(command, &iter);
+ break;
default:
ok = FALSE;
break;
diff --git a/src/stkutil.h b/src/stkutil.h
index dde62e6..809cb8c 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -183,6 +183,16 @@ enum stk_device_identity_type {
STK_DEVICE_IDENTITY_TYPE_KEYPAD = 0x01,
STK_DEVICE_IDENTITY_TYPE_DISPLAY = 0x02,
STK_DEVICE_IDENTITY_TYPE_EARPIECE = 0x03,
+ STK_DEVICE_IDENTITY_TYPE_CARD_READER_0 = 0x10,
+ STK_DEVICE_IDENTITY_TYPE_CARD_READER_1 = 0x11,
+ STK_DEVICE_IDENTITY_TYPE_CARD_READER_2 = 0x12,
+ STK_DEVICE_IDENTITY_TYPE_CARD_READER_3 = 0x13,
+ STK_DEVICE_IDENTITY_TYPE_CARD_READER_4 = 0x14,
+ STK_DEVICE_IDENTITY_TYPE_CARD_READER_5 = 0x15,
+ STK_DEVICE_IDENTITY_TYPE_CARD_READER_6 = 0x16,
+ STK_DEVICE_IDENTITY_TYPE_CARD_READER_7 = 0x17,
+ STK_DEVICE_IDENTITY_TYPE_CHANNEL_1 = 0x21,
+ STK_DEVICE_IDENTITY_TYPE_CHANNEL_7 = 0x27,
STK_DEVICE_IDENTITY_TYPE_UICC = 0x81,
STK_DEVICE_IDENTITY_TYPE_TERMINAL = 0x82,
STK_DEVICE_IDENTITY_TYPE_NETWORK = 0x83,
@@ -301,6 +311,60 @@ enum stk_icon_qualifier {
STK_ICON_QUALIFIER_TYPE_NON_SELF_EXPLANATORY = 0x01
};
+enum stk_ins {
+ STK_INS_DEACTIVATE_FILE = 0X04,
+ STK_INS_ERASE_RECORDS = 0X0C,
+ STK_INS_ERASE_BINARY_0E = 0X0E,
+ STK_INS_ERASE_BINARY_0F = 0X0F,
+ STK_INS_PERFORM_SCQL_OPERATION = 0X10,
+ STK_INS_PERFORM_TRANSACTION_OPERATION = 0X12,
+ STK_INS_PERFORM_USER_OPEPRATION = 0X14,
+ STK_INS_VERIFY_20 = 0X20,
+ STK_INS_VERIFY_21 = 0X21,
+ STK_INS_MANAGE_SECURITY_ENVIRONMENT = 0X22,
+ STK_INS_CHANGE_REFERENCE_DATA = 0X24,
+ STK_INS_DISABLE_VERIFICATION_REQUIREMENT = 0X26,
+ STK_INS_ENABLE_VERIFICATION_REQUIREMENT = 0X28,
+ STK_INS_PERFORM_SECURITY_OPERATION = 0X2A,
+ STK_INS_RESET_RETRY_COUNTER = 0X2C,
+ STK_INS_ACTIVATE_FILE = 0X44,
+ STK_INS_GENERATE_ASYMMETRIC_KEY_PAIR = 0X46,
+ STK_INS_MANAGE_CHANNEL = 0X70,
+ STK_INS_EXTERNAL_AUTHENTICATE = 0X82,
+ STK_INS_GET_CHALLENGE = 0X84,
+ STK_INS_GENERAL_AUTHENTICATE_86 = 0X86,
+ STK_INS_GENERAL_AUTHENTICATE_87 = 0X87,
+ STK_INS_INTERNAL_AUTHENTICATE = 0X88,
+ STK_INS_SEARCH_BINARY_A0 = 0XA0,
+ STK_INS_SEARCH_BINARY_A1 = 0XA1,
+ STK_INS_SEARCH_RECORD = 0XA2,
+ STK_INS_SELECT = 0XA4,
+ STK_INS_READ_BINARY_B0 = 0XB0,
+ STK_INS_READ_BINARY_B1 = 0XB1,
+ STK_INS_READ_RECORDS_B2 = 0XB2,
+ STK_INS_READ_RECORDS_B3 = 0XB3,
+ STK_INS_GET_RESPONSE = 0XC0,
+ STK_INS_ENVELOPE_C2 = 0XC2,
+ STK_INS_ENVELOPE_C3 = 0XC3,
+ STK_INS_GET_DATA_CA = 0XCA,
+ STK_INS_GET_DATA_CB = 0XCB,
+ STK_INS_WRITE_BINARY_D0 = 0XD0,
+ STK_INS_WRITE_BINARY_D1 = 0XD1,
+ STK_INS_WRITE_RECORD = 0XD2,
+ STK_INS_UPDATE_BINARY_D6 = 0XD6,
+ STK_INS_UPDATE_BINARY_D7 = 0XD7,
+ STK_INS_PUT_DATA_DA = 0XDA,
+ STK_INS_PUT_DATA_DB = 0XDB,
+ STK_INS_UPDATE_RECORD_DC = 0XDC,
+ STK_INS_UPDATE_RECORD_DD = 0XDD,
+ STK_INS_CREATE_FILE = 0XE0,
+ STK_INS_APPEND_RECORD = 0XE2,
+ STK_INS_DELETE_FILE = 0XE4,
+ STK_INS_TERMINATE_DF = 0XE6,
+ STK_INS_TERMINATE_EF = 0XE8,
+ STK_INS_TERMINATE_CARD_USAGE = 0XFE
+};
+
enum stk_browser_id {
STK_BROWSER_ID_DEFAULT = 0x00,
STK_BROWSER_ID_WML = 0x01,
@@ -887,6 +951,10 @@ struct stk_command_setup_event_list {
struct stk_event_list event_list;
};
+struct stk_command_perform_card_apdu {
+ struct stk_c_apdu c_apdu;
+};
+
struct stk_command {
unsigned char number;
unsigned char type;
@@ -906,6 +974,7 @@ struct stk_command {
struct stk_command_setup_call setup_call;
struct stk_command_refresh refresh;
struct stk_command_setup_event_list setup_event_list;
+ struct stk_command_perform_card_apdu perform_card_apdu;
};
void (*destructor)(struct stk_command *command);
--
1.7.0.4
next prev parent reply other threads:[~2010-05-13 10:48 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-13 10:48 [PATCH 01/27] stk: Add poll interval proactive command parser Yang Gu
2010-05-13 10:48 ` [PATCH 02/27] test-stkutil: Add test for poll interval parser Yang Gu
2010-05-13 10:48 ` [PATCH 03/27] stkutil: Add setup menu proactive command parser Yang Gu
2010-05-13 10:48 ` [PATCH 04/27] test-stkutil: Add test for setup menu parser Yang Gu
2010-05-13 10:48 ` [PATCH 05/27] stkutil: Add select item proactive command parser Yang Gu
2010-05-13 10:48 ` [PATCH 06/27] test-stkutil: Add test for select item parser Yang Gu
2010-05-13 10:48 ` [PATCH 07/27] test-stkutil: Use dedicated functions to check Yang Gu
2010-05-13 10:48 ` [PATCH 08/27] test-stkutil: Refactor test for send sms parser Yang Gu
2010-05-13 10:48 ` [PATCH 09/27] stk: Adjust the sequence of dataobj Yang Gu
2010-05-13 10:48 ` [PATCH 10/27] stkutil: Add setup call proactive command parser Yang Gu
2010-05-13 10:48 ` [PATCH 11/27] test-stkutil: Add unit test for setup call parser Yang Gu
2010-05-13 10:48 ` [PATCH 12/27] stkutil: Add refresh proactive command parser Yang Gu
2010-05-13 10:48 ` [PATCH 13/27] test-stkutil: Add test for refresh parser Yang Gu
2010-05-13 10:48 ` [PATCH 14/27] stkutil: Add polling off proactive command parser Yang Gu
2010-05-13 10:48 ` [PATCH 15/27] test-stkutil: Add test for polling off parser Yang Gu
2010-05-13 10:48 ` [PATCH 16/27] stkutil: Add provide local info command parser Yang Gu
2010-05-13 10:48 ` [PATCH 17/27] test-stk: Add test for provide local info parser Yang Gu
2010-05-13 10:48 ` [PATCH 18/27] stkutil: Add event list command parser Yang Gu
2010-05-13 10:48 ` [PATCH 19/27] test-stkutil: Add test for event list parser Yang Gu
2010-05-13 10:48 ` Yang Gu [this message]
2010-05-13 10:48 ` [PATCH 21/27] test-stk: Add test for perform card apdu parser Yang Gu
2010-05-13 10:48 ` [PATCH 22/27] stkutil: Add power off card command parser Yang Gu
2010-05-13 10:48 ` [PATCH 23/27] stkutil: Add power on " Yang Gu
2010-05-13 10:48 ` [PATCH 24/27] stkutil: Add get reader status " Yang Gu
2010-05-13 10:48 ` [PATCH 25/27] test-stk: Add test for get reader status parser Yang Gu
2010-05-13 10:48 ` [PATCH 26/27] stkutil: Add timer management command parser Yang Gu
2010-05-13 10:48 ` [PATCH 27/27] test-stk: Add test for timer management parser Yang Gu
2010-05-13 20:37 ` [PATCH 01/27] stk: Add poll interval proactive command parser Denis Kenzior
2010-05-14 8:37 ` Gu, Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1273747724-28019-20-git-send-email-yang.gu@intel.com \
--to=yang.gu@intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox