1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright (C) 2021, Foundries Limited
4  * Author: Jorge Ramirez <jorge@foundries.io>
5  */
6 
7 #ifndef __PTA_APDU_H
8 #define __PTA_APDU_H
9 
10 #define PTA_APDU_UUID { 0x3f3eb880, 0x3639, 0x11ec, \
11 			{ 0x9b, 0x9d, 0x0f, 0x3f, 0xc9, 0x46, 0x8f, 0x50 } }
12 
13 /*
14  * ADPU based communication with the Secure Element
15  *
16  * [in]  value[0].a           Use APDU TXRX hints: PTA_APDU_TXRX_CASE_*
17  * [in]  memref[1].buffer     APDU header.
18  * [in]  memref[1].size       APDU header length.
19  * [in]  memref[2].buffer     request (APDU raw frame).
20  * [in]  memref[2].size       request length.
21  * [out] memref[3].buffer     response (APDU raw frame).
22  * [out] memref[3].size       response length.
23  *
24  * Result:
25  * TEE_SUCCESS - Invoke command success
26  * TEE_ERROR_BAD_PARAMETERS - Incorrect input param
27  * TEE_ERROR_NOT_IMPLEMENTED - Invoke command not implemented
28  * TEE_ERROR_GENERIC - Invoke command failure
29  */
30 #define PTA_CMD_TXRX_APDU_RAW_FRAME		0
31 
32 /*
33  * Type identifier for the APDU message as described by Smart Card Standard
34  * ISO7816-4 about ADPU message bodies decoding convention:
35  *
36  * https://cardwerk.com/smart-card-standard-iso7816-4-section-5-basic-organizations/#chap5_3_2
37  */
38 #define PTA_APDU_TXRX_CASE_NO_HINT	0
39 #define PTA_APDU_TXRX_CASE_1		1
40 #define PTA_APDU_TXRX_CASE_2		2
41 #define PTA_APDU_TXRX_CASE_2E		3
42 #define PTA_APDU_TXRX_CASE_3		4
43 #define PTA_APDU_TXRX_CASE_3E		5
44 #define PTA_APDU_TXRX_CASE_4		6
45 #define PTA_APDU_TXRX_CASE_4E		7
46 
47 #endif /* __PTA_APDU_H */
48