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#ifndef __S_ERROR_H__ 31#define __S_ERROR_H__ 32 33#define S_SUCCESS ((S_RESULT)0x00000000) 34#define SM_SUCCESS S_SUCCESS 35#define TEEC_SUCCESS S_SUCCESS 36#define SST_SUCCESS S_SUCCESS 37 38/** 39 * Generic error code : Generic error 40 **/ 41#define S_ERROR_GENERIC ((S_RESULT)0xFFFF0000) 42#define SM_ERROR_GENERIC S_ERROR_GENERIC 43#define TEEC_ERROR_GENERIC S_ERROR_GENERIC 44#define SST_ERROR_GENERIC S_ERROR_GENERIC 45 46/** 47 * Generic error code : The underlying security system denies the access to the 48 * object 49 **/ 50#define S_ERROR_ACCESS_DENIED ((S_RESULT)0xFFFF0001) 51#define SM_ERROR_ACCESS_DENIED S_ERROR_ACCESS_DENIED 52#define TEEC_ERROR_ACCESS_DENIED S_ERROR_ACCESS_DENIED 53#define SST_ERROR_ACCESS_DENIED S_ERROR_ACCESS_DENIED 54 55/** 56 * Generic error code : The pending operation is cancelled. 57 **/ 58#define S_ERROR_CANCEL ((S_RESULT)0xFFFF0002) 59#define SM_ERROR_CANCEL S_ERROR_CANCEL 60#define TEEC_ERROR_CANCEL S_ERROR_CANCEL 61 62/** 63 * Generic error code : The underlying system detects a conflict 64 **/ 65#define S_ERROR_ACCESS_CONFLICT ((S_RESULT)0xFFFF0003) 66#define SM_ERROR_EXCLUSIVE_ACCESS S_ERROR_ACCESS_CONFLICT 67#define TEEC_ERROR_ACCESS_CONFLICT S_ERROR_ACCESS_CONFLICT 68#define SST_ERROR_ACCESS_CONFLICT S_ERROR_ACCESS_CONFLICT 69 70/** 71 * Generic error code : Too much data for the operation or some data remain 72 * unprocessed by the operation. 73 **/ 74#define S_ERROR_EXCESS_DATA ((S_RESULT)0xFFFF0004) 75#define SM_ERROR_EXCESS_DATA S_ERROR_EXCESS_DATA 76#define TEEC_ERROR_EXCESS_DATA S_ERROR_EXCESS_DATA 77 78 79/** 80 * Generic error code : Error of data format 81 **/ 82#define S_ERROR_BAD_FORMAT ((S_RESULT)0xFFFF0005) 83#define SM_ERROR_FORMAT S_ERROR_BAD_FORMAT 84#define TEEC_ERROR_BAD_FORMAT S_ERROR_BAD_FORMAT 85 86/** 87 * Generic error code : The specified parameters are invalid 88 **/ 89#define S_ERROR_BAD_PARAMETERS ((S_RESULT)0xFFFF0006) 90#define SM_ERROR_ILLEGAL_ARGUMENT S_ERROR_BAD_PARAMETERS 91#define TEEC_ERROR_BAD_PARAMETERS S_ERROR_BAD_PARAMETERS 92#define SST_ERROR_BAD_PARAMETERS S_ERROR_BAD_PARAMETERS 93 94 95/** 96 * Generic error code : Illegal state for the operation. 97 **/ 98#define S_ERROR_BAD_STATE ((S_RESULT)0xFFFF0007) 99#define SM_ERROR_ILLEGAL_STATE S_ERROR_BAD_STATE 100#define TEEC_ERROR_BAD_STATE S_ERROR_BAD_STATE 101 102/** 103 * Generic error code : The item is not found 104 **/ 105#define S_ERROR_ITEM_NOT_FOUND ((S_RESULT)0xFFFF0008) 106#define SM_ERROR_ITEM_NOT_FOUND S_ERROR_ITEM_NOT_FOUND 107#define TEEC_ERROR_ITEM_NOT_FOUND S_ERROR_ITEM_NOT_FOUND 108#define SST_ERROR_ITEM_NOT_FOUND S_ERROR_ITEM_NOT_FOUND 109 110/** 111 * Generic error code : The specified operation is not implemented 112 **/ 113#define S_ERROR_NOT_IMPLEMENTED ((S_RESULT)0xFFFF0009) 114#define SM_ERROR_NOT_IMPLEMENTED S_ERROR_NOT_IMPLEMENTED 115#define TEEC_ERROR_NOT_IMPLEMENTED S_ERROR_NOT_IMPLEMENTED 116 117/** 118 * Generic error code : The specified operation is not supported 119 **/ 120#define S_ERROR_NOT_SUPPORTED ((S_RESULT)0xFFFF000A) 121#define SM_ERROR_NOT_SUPPORTED S_ERROR_NOT_SUPPORTED 122#define TEEC_ERROR_NOT_SUPPORTED S_ERROR_NOT_SUPPORTED 123 124/** 125 * Generic error code : Insufficient data is available for the operation. 126 **/ 127#define S_ERROR_NO_DATA ((S_RESULT)0xFFFF000B) 128#define SM_ERROR_NO_DATA S_ERROR_NO_DATA 129#define TEEC_ERROR_NO_DATA S_ERROR_NO_DATA 130 131/** 132 * Generic error code : Not enough memory to perform the operation 133 **/ 134#define S_ERROR_OUT_OF_MEMORY ((S_RESULT)0xFFFF000C) 135#define SM_ERROR_OUT_OF_MEMORY S_ERROR_OUT_OF_MEMORY 136#define TEEC_ERROR_OUT_OF_MEMORY S_ERROR_OUT_OF_MEMORY 137#define SST_ERROR_OUT_OF_MEMORY S_ERROR_OUT_OF_MEMORY 138 139/** 140 * Generic error code : The service is currently unable to handle the request; 141 * try later 142 **/ 143#define S_ERROR_BUSY ((S_RESULT)0xFFFF000D) 144#define SM_ERROR_BUSY S_ERROR_BUSY 145#define TEEC_ERROR_BUSY S_ERROR_BUSY 146 147/** 148 * Generic error code : security violation 149 **/ 150#define S_ERROR_SECURITY ((S_RESULT)0xFFFF000F) 151#define SM_ERROR_SECURITY S_ERROR_SECURITY 152#define TEEC_ERROR_SECURITY S_ERROR_SECURITY 153 154/** 155 * Generic error code : the buffer is too short 156 **/ 157#define S_ERROR_SHORT_BUFFER ((S_RESULT)0xFFFF0010) 158#define SM_ERROR_SHORT_BUFFER S_ERROR_SHORT_BUFFER 159#define TEEC_ERROR_SHORT_BUFFER S_ERROR_SHORT_BUFFER 160 161 162/** 163 * Generic error code : SControl Asynchronous Operations are not supported. 164 */ 165#define S_ERROR_ASYNC_OPERATIONS_NOT_SUPPORTED ((S_RESULT)0xFFFF0011) 166#define SM_ERROR_ASYNC_OPERATIONS_NOT_SUPPORTED S_ERROR_ASYNC_OPERATIONS_NOT_SUPPORTED 167 168/** 169 * Generic error code : the number of handles currently created 170 * for a specific resource has reached the maximum amount. 171 **/ 172#define S_ERROR_NO_MORE_HANDLES ((S_RESULT)0xFFFF0013) 173 174/** 175 * Generic error code : the monotonic counter is corrupted 176 **/ 177#define S_ERROR_CORRUPTED ((S_RESULT)0xFFFF0014) 178 179/** 180 * Generic error code : the operation is not terminated 181 **/ 182#define S_PENDING ((S_RESULT)0xFFFF2000) 183 184/** 185 * Generic error code : A timeout occurred 186 **/ 187#define S_ERROR_TIMEOUT ((S_RESULT)0xFFFF3001) 188 189/** 190 * Error code: Error of the underlying OS. 191 **/ 192#define S_ERROR_UNDERLYING_OS ((S_RESULT)0xFFFF3002) 193#define TEEC_ERROR_OS S_ERROR_UNDERLYING_OS 194 195 196/** 197 * Error code: The operation is cancelled by a signal. 198 **/ 199#define S_ERROR_CANCELLED_BY_SIGNAL ((S_RESULT)0xFFFF3003) 200 201/** 202 * Generic error code : Overflow 203 **/ 204#define S_ERROR_OVERFLOW ((S_RESULT)0xFFFF300F) 205#define SST_ERROR_OVERFLOW S_ERROR_OVERFLOW 206 207/** 208 * Generic error code : The item already exists 209 **/ 210#define S_ERROR_ITEM_EXISTS ((S_RESULT)0xFFFF3012) 211 212/** 213 * Generic error code : The application reported an error. The code of the 214 * applicative error is encoded in the message data. 215 */ 216#define S_ERROR_SERVICE ((S_RESULT)0xFFFF1000) 217#define SM_ERROR_SERVICE S_ERROR_SERVICE 218 219#define S_PENDING ((S_RESULT)0xFFFF2000) 220#define SM_PENDING S_PENDING 221 222/** 223 * Generic error code : Critical error causing the platform to shutdown. 224 */ 225#define S_ERROR_CRITICAL ((S_RESULT)0xFFFF3010) 226 227/** 228 * Generic error code : the underlying peripheral is unreachable. 229 */ 230#define S_ERROR_UNREACHABLE ((S_RESULT)0xFFFF3013) 231 232/*------------------------------------------------------------------------------ 233 Communication Error Codes 234------------------------------------------------------------------------------*/ 235/** 236 * Generic communication error 237 **/ 238#define S_ERROR_COMMUNICATION ((S_RESULT)0xFFFF000E) 239#define SM_ERROR_COMMUNICATION S_ERROR_COMMUNICATION 240#define TEEC_ERROR_COMMUNICATION S_ERROR_COMMUNICATION 241 242/** 243 * Error of communication : Error of protocol 244 **/ 245#define S_ERROR_CONNECTION_PROTOCOL ((S_RESULT)0xFFFF3020) 246 247/** 248 * Error of communication : The connection is broken. 249 **/ 250#define S_ERROR_CONNECTION_BROKEN ((S_RESULT)0xFFFF3021) 251 252/** 253 * Error of communication : Error during the connection setup. 254 **/ 255#define S_ERROR_CONNECTION_SETUP ((S_RESULT)0xFFFF3022) 256 257/** 258 * Error of communication : The connection is refused by the distant target. 259 **/ 260#define S_ERROR_CONNECTION_REFUSED ((S_RESULT)0xFFFF3023) 261 262/** 263 * Error of communication: The target of the connection is dead 264 **/ 265#define S_ERROR_TARGET_DEAD ((S_RESULT)0xFFFF3024) 266#define SM_ERROR_TARGET_DEAD S_ERROR_TARGET_DEAD 267#define TEEC_ERROR_TARGET_DEAD S_ERROR_TARGET_DEAD 268 269 270/*------------------------------------------------------------------------------ 271 Storage Error Codes 272------------------------------------------------------------------------------*/ 273 274/** File system error code: not enough space to complete the operation. */ 275#define S_ERROR_STORAGE_NO_SPACE ((S_RESULT)0xFFFF3041) 276#define SST_ERROR_NO_SPACE 0xFFFF3041 277 278/** 279 * File system error code: The file system is corrupted. 280 */ 281#define S_ERROR_STORAGE_CORRUPTED ((S_RESULT)0xFFFF3045) 282#define SST_ERROR_CORRUPTED S_ERROR_STORAGE_CORRUPTED 283 284/** 285 * File system error code: The file system is unreachable. 286 */ 287#define S_ERROR_STORAGE_UNREACHABLE ((S_RESULT)0xFFFF3046) 288 289/*------------------------------------------------------------------------------ 290 Authentication / X509 error codes 291------------------------------------------------------------------------------*/ 292#define S_ERROR_AUTHENTICATION_FAILED ((S_RESULT)0xFFFF3060) 293#define S_ERROR_WRONG_SIGNATURE ((S_RESULT)0xFFFF3061) 294#define S_ERROR_BAD_CERTIFICATE ((S_RESULT)0xFFFF3062) 295#define S_ERROR_WRONG_ISSUER ((S_RESULT)0xFFFF3063) 296#define S_ERROR_CERTIFICATE_EXPIRED ((S_RESULT)0xFFFF3064) 297 298/*------------------------------------------------------------------------------ 299 Crypto error codes 300------------------------------------------------------------------------------*/ 301#define S_ERROR_BAD_KEY ((S_RESULT)0xFFFF3070) 302 303/*------------------------------------------------------------------------------ 304 Indicates the physical memory is in TCM 305------------------------------------------------------------------------------*/ 306#define S_ERROR_ARM_MEMORY_IS_TCM ((S_RESULT)0xFFFF3100) 307 308/*------------------------------------------------------------------------------ 309 VM-specific Error Codes 310------------------------------------------------------------------------------*/ 311#define S_ERROR_UNCAUGHT_EXCEPTION ((S_RESULT)0xFFFF3080) 312#define S_ERROR_TRUSTED_INTERPRETER ((S_RESULT)0xFFFF3081) 313 314 315/*------------------------------------------------------------------------------ 316 Range [0xFFFF3200:0xFFFF35FF] is reserved for internal use 317------------------------------------------------------------------------------*/ 318 319#endif /* __S_ERROR_H__ */ 320 321 322