xref: /optee_os/ta/pkcs11/include/pkcs11_ta.h (revision d408db99ed4c976d2cf52cfd394f8ef93073a8bc)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2018-2020, Linaro Limited
4  */
5 
6 #ifndef PKCS11_TA_H
7 #define PKCS11_TA_H
8 
9 #include <stdbool.h>
10 #include <stdint.h>
11 
12 #define PKCS11_TA_UUID { 0xfd02c9da, 0x306c, 0x48c7, \
13 			 { 0xa4, 0x9c, 0xbb, 0xd8, 0x27, 0xae, 0x86, 0xee } }
14 
15 /* PKCS11 trusted application version information */
16 #define PKCS11_TA_VERSION_MAJOR			0
17 #define PKCS11_TA_VERSION_MINOR			1
18 #define PKCS11_TA_VERSION_PATCH			0
19 
20 /* Attribute specific values */
21 #define PKCS11_UNAVAILABLE_INFORMATION		UINT32_C(0xFFFFFFFF)
22 #define PKCS11_UNDEFINED_ID			PKCS11_UNAVAILABLE_INFORMATION
23 #define PKCS11_FALSE				false
24 #define PKCS11_TRUE				true
25 
26 /*
27  * Note on PKCS#11 TA commands ABI
28  *
29  * For evolution of the TA API and to not mess with the GPD TEE 4 parameters
30  * constraint, all the PKCS11 TA invocation commands use a subset of available
31  * the GPD TEE invocation parameter types.
32  *
33  * Param#0 is used for the so-called control arguments of the invoked command
34  * and for providing a PKCS#11 compliant status code for the request command.
35  * Param#0 is an in/out memory reference (aka memref[0]). The input buffer
36  * stores the command arguments serialized inside. The output buffer will
37  * store the 32bit TA return code for the command. Client shall get this
38  * return code and override the GPD TEE Client API legacy TEE_Result value.
39  *
40  * Param#1 is used for input data arguments of the invoked command.
41  * It is unused or is a input memory reference, aka memref[1].
42  * Evolution of the API may use memref[1] for output data as well.
43  *
44  * Param#2 is mostly used for output data arguments of the invoked command
45  * and for output handles generated from invoked commands.
46  * Few commands uses it for a secondary input data buffer argument.
47  * It is unused or is a input/output/in-out memory reference, aka memref[2].
48  *
49  * Param#3 is currently unused and reserved for evolution of the API.
50  */
51 
52 /*
53  * PKCS11_CMD_PING		Acknowledge TA presence and return version info
54  *
55  * Optinal invocation parameter (if none, command simply returns with success)
56  * [out]        memref[2] = [
57  *                      32bit version major value,
58  *                      32bit version minor value
59  *                      32bit version patch value
60  *              ]
61  */
62 #define PKCS11_CMD_PING				0
63 #endif /*PKCS11_TA_H*/
64