/**
* \file CommLayerDataPublic.h
* \brief Public defines and types. Distributes with API.
* \author Dmytro Podgornyi (d.podgornyi@samsung.com)
* \version 0.1
* \date Created Nov 21, 2013
* \par In Samsung Ukraine R&D Center (SURC) under a contract between
* \par LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine) and
* \par "Samsung Elecrtronics Co", Ltd (Seoul, Republic of Korea)
* \par Copyright: (c) Samsung Electronics Co, Ltd 2012. All rights reserved.
**/

#ifndef __COMMLAYERDATAPUBLIC_H_INCLUDED__
#define __COMMLAYERDATAPUBLIC_H_INCLUDED__

#include <stdint.h>

/* Error codes */
#define NOT_ERROR                            			 0
#define UNSUPPORTED_CMD                     ( int32_t ) -1
#define WRONG_DATA                          ( int32_t ) -2
#define PLATFORM_INTERNAL_ERROR             ( int32_t ) -3
#define SHA256_ERROR                        ( int32_t ) -4
#define HMAC_ERROR                          ( int32_t ) -5
#define FS_READ_ERROR                       ( int32_t ) -6
#define WRONG_RSA_CERT                      ( int32_t ) -7
#define WRONG_PRIV_KEY                      ( int32_t ) -8
#define NO_KEY_ERROR                        ( int32_t ) -9
#define WRITE_KEY_ERROR                     ( int32_t ) -10
#define READ_KEY_ERROR                      ( int32_t ) -11
#define WRITE_SYMM_KEY_ERROR                ( int32_t ) -12
#define INSTALL_SYMM_KEY_ERROR              ( int32_t ) -14
#define NO_SYMM_KEY_ERROR                   ( int32_t ) -15 // be reserved by libseckeyprov.so
#define DECRYPT_PROV_ERROR                  ( int32_t ) -16
#define COPY_PROV_ERROR                     ( int32_t ) -17
#define LOCK_FILE_FAIL_ERROR                ( int32_t ) -18
#define PERMISSION_DENIED                   ( int32_t ) -19
#define TLV_WRITE_ERROR                     ( int32_t ) -20
#define SKM_DAEMON_ERROR                    ( int32_t ) -21
#define BUFFER_OVERFLOW                     ( int32_t ) -22
#define TIME_UNAVAILABLE_ERROR              ( int32_t ) -23
#define TA_LOAD_ERROR                       ( int32_t ) -24
#define TA_UNLOAD_ERROR                     ( int32_t ) -25
#define TA_CONNECT_ERROR                    ( int32_t ) -26
#define BASE64_ERROR                        ( int32_t ) -27
#define FS_WRITE_ERROR                      ( int32_t ) -28
#define FS_GENERAL_ERROR                    ( int32_t ) -29
#define SERVICE_NAME_INVALID                ( int32_t ) -30
#define SERVICE_NAME_IS_WRONG               ( int32_t ) -31
#define SYSPROP_READ_ERROR                  ( int32_t ) -32
#define SEC_ALLOC_ERROR                     ( int32_t ) -33
#define SHA1_ERROR                          ( int32_t ) -34
#define KEK_PARSE_ERROR                     ( int32_t ) -35
#define ASN1_GEN_ERROR                      ( int32_t ) -36
#define CERT_SIGN_ERROR                     ( int32_t ) -37
#define RSA_GEN_ERROR                       ( int32_t ) -38
#define EC_GEN_ERROR                        ( int32_t ) -39
#define QSEE_ENCAP_ERROR                    ( int32_t ) -40
#define RSA_PARSE_ERROR                     ( int32_t ) -41
#define SIGNATURE_INVALID_ERROR             ( int32_t ) -42
#define WRONG_SERVICE_CERT_TYPE             ( int32_t ) -43
#define MEM_ALLOC_ERROR                     ( int32_t ) -41
#define SOCKET_INVALID                      ( int32_t ) -42
#define SOCKET_SEND_FAILED                  ( int32_t ) -43
#define SOCKET_RECV_FAILED                  ( int32_t ) -44
#define TLV_NOT_PRESENT_ERROR               ( int32_t ) -45
#define SFS_ACCESS_ATTEMPT                  ( int32_t ) -46
#define QSEE_DECAP_ERROR                    ( int32_t ) -47
#define OPENSSL_ERROR                       ( int32_t ) -48

#define REMOVE_DRK_ERROR                    ( int32_t ) -50
#define KEY_SIZE_ERROR                      ( int32_t ) -57
#define TZBSP_SECURE_STATE_CHECK_ERROR      ( int32_t ) -58

#define TZ_KDF_ERROR                        ( int32_t ) -60
#define TZ_RNG_ERROR                        ( int32_t ) -61
#define TZ_CRYPTO_ENC_ERROR                 ( int32_t ) -62
#define TZ_CRYPTO_DEC_ERROR                 ( int32_t ) -63
#define TZ_CRYPTO_WRONG_TAG_ERROR           ( int32_t ) -64
#define TZ_CRYPTO_INIT_ERROR                ( int32_t ) -65

#define TID_INVALID_ERROR                   ( int32_t ) -66 
#define CRYPTO_CORE_INTERNAL_ERROR          ( int32_t ) -67
#define OPENSSL_MINI_INTERNAL_ERROR         ( int32_t ) -68
#define GP_CRYPTO_INTERNAL_ERROR            ( int32_t ) -69
#define X509_INTERNAL_ERROR                 ( int32_t ) -70

#define WB_INTERNAL_ERROR                   ( int32_t ) -71
#define WB_ENCRYPT_ERROR                    ( int32_t ) -72
#define WB_DECRYPT_ERROR                    ( int32_t ) -73

#define WAIT_CONDITION_ERROR                ( int32_t ) -80
#define RILD_CONNECT_ERROR                  ( int32_t ) -81
#define RILD_REQUEST_HOOK_ERROR             ( int32_t ) -82
#define RILD_SET_HANDLER_ERROR              ( int32_t ) -83

#define CERT_IS_REVOCATED                   ( int32_t ) -90

#define COMMON_ERROR                        ( int32_t ) -126
#define NOT_IMPLEMENTED                     ( int32_t ) -127

#define EXPORT __attribute__((visibility("default")))

#endif /* __COMMLAYERDATAPUBLIC_H_INCLUDED__ */
