1 /**
2  * Copyright(c) 2011 Trusted Logic.   All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  *  * Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in
12  *    the documentation and/or other materials provided with the
13  *    distribution.
14  *  * Neither the name Trusted Logic nor the names of its
15  *    contributors may be used to endorse or promote products derived
16  *    from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef __SERVICE_SYSTEM_PROTOCOL_H__
32 #define __SERVICE_SYSTEM_PROTOCOL_H__
33 
34 #include "s_type.h"
35 
36 /* -----------------------------------------------------------------------------
37       UUID and Name
38 ----------------------------------------------------------------------------- */
39 
40 /** Service Identifier */
41 /* {56304b83-5c4e-4428-b99e-605c96ae58d6} */
42 #define SERVICE_SYSTEM_UUID   { 0x56304b83, 0x5c4e, 0x4428, { 0xb9, 0x9e, 0x60, 0x5c, 0x96, 0xae, 0x58, 0xd6 } }
43 
44 /** Generic type for error codes in the system service */
45 #define SERVICE_SYSTEM_NAME_ASCII  "SYSTEM"
46 
47 
48 /* -----------------------------------------------------------------------------
49                                SST Command identifiers
50 ----------------------------------------------------------------------------- */
51 
52 #define SERVICE_SYSTEM_SST_OPEN_COMMAND_ID                0x00000001
53 #define SERVICE_SYSTEM_SST_CLOSE_COMMAND_ID               0x00000002
54 #define SERVICE_SYSTEM_SST_READ_COMMAND_ID                0x00000003
55 #define SERVICE_SYSTEM_SST_WRITE_COMMAND_ID               0x00000004
56 #define SERVICE_SYSTEM_SST_SEEK_COMMAND_ID                0x00000005
57 #define SERVICE_SYSTEM_SST_GET_OFFSET_AND_SIZE_COMMAND_ID 0x00000007
58 #define SERVICE_SYSTEM_SST_GET_SIZE_COMMAND_ID            0x00000008
59 #define SERVICE_SYSTEM_SST_CLOSE_DELETE_COMMAND_ID        0x00000009
60 #define SERVICE_SYSTEM_SST_TRUNCATE_COMMAND_ID            0x0000000A
61 #define SERVICE_SYSTEM_SST_ENUM_START_COMMAND_ID          0x0000000B
62 #define SERVICE_SYSTEM_SST_ENUM_GETNEXT_COMMAND_ID        0x0000000C
63 #define SERVICE_SYSTEM_SST_ENUM_CLOSE_COMMAND_ID          0x0000000D
64 #define SERVICE_SYSTEM_SST_RENAME_COMMAND_ID              0x0000000E
65 
66 /* -----------------------------------------------------------------------------
67                       PKCS11/MTC Command identifiers
68 ----------------------------------------------------------------------------- */
69 #define SERVICE_SYSTEM_PKCS11_C_CREATEOBJECT_COMMAND_ID      0x00000020
70 #define SERVICE_SYSTEM_PKCS11_C_DESTROYOBJECT_COMMAND_ID     0x00000021
71 #define SERVICE_SYSTEM_PKCS11_C_GETATTRIBUTEVALUE_COMMAND_ID 0x00000022
72 #define SERVICE_SYSTEM_PKCS11_C_FINDOBJECTSINIT_COMMAND_ID   0x00000023
73 #define SERVICE_SYSTEM_PKCS11_C_FINDOBJECTS_COMMAND_ID       0x00000024
74 #define SERVICE_SYSTEM_PKCS11_C_FINDOBJECTSFINAL_COMMAND_ID  0x00000025
75 #define SERVICE_SYSTEM_PKCS11_C_DIGESTINIT_COMMAND_ID        0x00000026
76 #define SERVICE_SYSTEM_PKCS11_C_DIGEST_COMMAND_ID            0x00000027
77 #define SERVICE_SYSTEM_PKCS11_C_DIGESTUPDATE_COMMAND_ID      0x00000028
78 #define SERVICE_SYSTEM_PKCS11_C_DIGESTFINAL_COMMAND_ID       0x00000029
79 #define SERVICE_SYSTEM_PKCS11_C_SIGNINIT_COMMAND_ID          0x0000002A
80 #define SERVICE_SYSTEM_PKCS11_C_SIGN_COMMAND_ID              0x0000002B
81 #define SERVICE_SYSTEM_PKCS11_C_SIGNUPDATE_COMMAND_ID        0x0000002C
82 #define SERVICE_SYSTEM_PKCS11_C_SIGNFINAL_COMMAND_ID         0x0000002D
83 #define SERVICE_SYSTEM_PKCS11_C_ENCRYPTINIT_COMMAND_ID       0x0000002E
84 #define SERVICE_SYSTEM_PKCS11_C_ENCRYPT_COMMAND_ID           0x0000002F
85 #define SERVICE_SYSTEM_PKCS11_C_ENCRYPTUPDATE_COMMAND_ID     0x00000030
86 #define SERVICE_SYSTEM_PKCS11_C_ENCRYPTFINAL_COMMAND_ID      0x00000031
87 #define SERVICE_SYSTEM_PKCS11_C_DECRYPTINIT_COMMAND_ID       0x00000032
88 #define SERVICE_SYSTEM_PKCS11_C_DECRYPT_COMMAND_ID           0x00000033
89 #define SERVICE_SYSTEM_PKCS11_C_DECRYPTUPDATE_COMMAND_ID     0x00000034
90 #define SERVICE_SYSTEM_PKCS11_C_DECRYPTFINAL_COMMAND_ID      0x00000035
91 #define SERVICE_SYSTEM_PKCS11_C_GENERATEKEY_COMMAND_ID       0x00000036
92 #define SERVICE_SYSTEM_PKCS11_C_GENERATEKEYPAIR_COMMAND_ID   0x00000037
93 #define SERVICE_SYSTEM_PKCS11_C_SEEDRANDOM_COMMAND_ID        0x00000038
94 #define SERVICE_SYSTEM_PKCS11_C_GENERATERANDOM_COMMAND_ID    0x00000039
95 #define SERVICE_SYSTEM_PKCS11_C_VERIFYINIT_COMMAND_ID        0x0000003A
96 #define SERVICE_SYSTEM_PKCS11_C_VERIFY_COMMAND_ID            0x0000003B
97 #define SERVICE_SYSTEM_PKCS11_C_VERIFYUPDATE_COMMAND_ID      0x0000003C
98 #define SERVICE_SYSTEM_PKCS11_C_VERIFYFINAL_COMMAND_ID       0x0000003D
99 #define SERVICE_SYSTEM_PKCS11_C_DERIVEKEY_COMMAND_ID         0x0000003E
100 #define SERVICE_SYSTEM_PKCS11_C_ABORTOPERATION_COMMAND_ID    0x0000003F
101 #define SERVICE_SYSTEM_PKCS11_C_COPYOBJECT_COMMAND_ID        0x00000040
102 #define SERVICE_SYSTEM_PKCS11_C_CLOSEOBJECTHANDLE_COMMAND_ID 0x00000041
103 #define SERVICE_SYSTEM_PKCS11_C_OPEN_SESSION_COMMAND_ID      0x00000042
104 #define SERVICE_SYSTEM_PKCS11_C_CLOSE_SESSION_COMMAND_ID     0x00000043
105 #define SERVICE_SYSTEM_PKCS11_INCREMENT_MTC_COMMAND_ID       0x00000044
106 #define SERVICE_SYSTEM_PKCS11_GET_MTC_COMMAND_ID             0x00000045
107 
108 typedef struct
109 {
110    uint32_t             attributeType;
111    uint32_t             dataOffset : 30;
112    uint32_t             dataParamIndex  : 2;
113    uint32_t             dataValueLen;
114 } INPUT_TEMPLATE_ITEM;
115 
116 #endif /* __SERVICE_SYSTEM_PROTOCOL_H__ */
117