aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-08-27 18:39:48 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-09-24 20:30:47 -0400
commit72b70b6ec4fa7da86a3ac0aacee699b18d94fc3b (patch)
treefb9e9e0a29349ca9e294492bad8195e9a84ce931 /include
parentb9c0c678f7267831b73e1d73fb30c9b4658e91ec (diff)
NFC: Define secure element IO API and commands
In order to send and receive ISO7816 APDUs to and from NFC embedded secure elements, we define a specific netlink command. On a typical SE use case, host applications will send very few APDUs (Less than 10) per transaction. This is why we decided to go for a simple netlink API. Defining another NFC socket protocol for such low traffic would have been overengineered. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/net/nfc/nfc.h5
-rw-r--r--include/uapi/linux/nfc.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 5329804ebb70..82fc4e43fc6e 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -53,6 +53,8 @@ struct nfc_dev;
53typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb, 53typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
54 int err); 54 int err);
55 55
56typedef void (*se_io_cb_t)(void *context, u8 *apdu, size_t apdu_len, int err);
57
56struct nfc_target; 58struct nfc_target;
57 59
58struct nfc_ops { 60struct nfc_ops {
@@ -79,6 +81,9 @@ struct nfc_ops {
79 int (*discover_se)(struct nfc_dev *dev); 81 int (*discover_se)(struct nfc_dev *dev);
80 int (*enable_se)(struct nfc_dev *dev, u32 se_idx); 82 int (*enable_se)(struct nfc_dev *dev, u32 se_idx);
81 int (*disable_se)(struct nfc_dev *dev, u32 se_idx); 83 int (*disable_se)(struct nfc_dev *dev, u32 se_idx);
84 int (*se_io) (struct nfc_dev *dev, u32 se_idx,
85 u8 *apdu, size_t apdu_length,
86 se_io_cb_t cb, void *cb_context);
82}; 87};
83 88
84#define NFC_TARGET_IDX_ANY -1 89#define NFC_TARGET_IDX_ANY -1
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 29bed72a4ac4..6ad6cc03ccd3 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -85,6 +85,7 @@
85 * a specific SE notifies us about the end of a transaction. The parameter 85 * a specific SE notifies us about the end of a transaction. The parameter
86 * for this event is the application ID (AID). 86 * for this event is the application ID (AID).
87 * @NFC_CMD_GET_SE: Dump all discovered secure elements from an NFC controller. 87 * @NFC_CMD_GET_SE: Dump all discovered secure elements from an NFC controller.
88 * @NFC_CMD_SE_IO: Send/Receive APDUs to/from the selected secure element.
88 */ 89 */
89enum nfc_commands { 90enum nfc_commands {
90 NFC_CMD_UNSPEC, 91 NFC_CMD_UNSPEC,
@@ -114,6 +115,7 @@ enum nfc_commands {
114 NFC_EVENT_SE_CONNECTIVITY, 115 NFC_EVENT_SE_CONNECTIVITY,
115 NFC_EVENT_SE_TRANSACTION, 116 NFC_EVENT_SE_TRANSACTION,
116 NFC_CMD_GET_SE, 117 NFC_CMD_GET_SE,
118 NFC_CMD_SE_IO,
117/* private: internal use only */ 119/* private: internal use only */
118 __NFC_CMD_AFTER_LAST 120 __NFC_CMD_AFTER_LAST
119}; 121};
@@ -147,6 +149,7 @@ enum nfc_commands {
147 * @NFC_ATTR_SE_INDEX: Secure element index 149 * @NFC_ATTR_SE_INDEX: Secure element index
148 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED) 150 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED)
149 * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status 151 * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status
152 * @NFC_ATTR_APDU: Secure element APDU
150 */ 153 */
151enum nfc_attrs { 154enum nfc_attrs {
152 NFC_ATTR_UNSPEC, 155 NFC_ATTR_UNSPEC,
@@ -174,6 +177,7 @@ enum nfc_attrs {
174 NFC_ATTR_SE_TYPE, 177 NFC_ATTR_SE_TYPE,
175 NFC_ATTR_SE_AID, 178 NFC_ATTR_SE_AID,
176 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, 179 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS,
180 NFC_ATTR_SE_APDU,
177/* private: internal use only */ 181/* private: internal use only */
178 __NFC_ATTR_AFTER_LAST 182 __NFC_ATTR_AFTER_LAST
179}; 183};