// Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved
//
// This file and the related binary are licensed under the ARM Object Code and
// Headers License; you may not use these files except in compliance with this
// license.
//
// You may obtain a copy of the License at <.../external/nrf_cc310/license.txt>
//
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef CRYS_ECPKI_ERROR_H
#define CRYS_ECPKI_ERROR_H


/*!
@file
@brief This module contains the definitions of the CRYS ECPKI errors.
*/

#include "crys_error.h"

#ifdef __cplusplus
extern "C"
{
#endif


/************************ Defines ******************************/

/* CRYS_ECPKI_MODULE_ERROR_BASE = 0x00F00800  */

/*********************************************************************************************
 * CRYS ECPKI MODULE ERRORS                                                                  *
 *********************************************************************************************/
#define CRYS_ECPKI_ILLEGAL_D0MAIN_ID_ERROR	                (CRYS_ECPKI_MODULE_ERROR_BASE + 0x1UL)
#define CRYS_ECPKI_DOMAIN_PTR_ERROR	  			(CRYS_ECPKI_MODULE_ERROR_BASE + 0x2UL)
/* The CRYS ECPKI GEN KEY PAIR module errors */
#define CRYS_ECPKI_GEN_KEY_INVALID_PRIVATE_KEY_PTR_ERROR        (CRYS_ECPKI_MODULE_ERROR_BASE + 0x3UL)
#define CRYS_ECPKI_GEN_KEY_INVALID_PUBLIC_KEY_PTR_ERROR         (CRYS_ECPKI_MODULE_ERROR_BASE + 0x4UL)
#define CRYS_ECPKI_GEN_KEY_INVALID_TEMP_DATA_PTR_ERROR          (CRYS_ECPKI_MODULE_ERROR_BASE + 0x5UL)
#define CRYS_ECPKI_RND_CONTEXT_PTR_ERROR	  		(CRYS_ECPKI_MODULE_ERROR_BASE + 0x6UL)

/************************************************************************************************************
* The CRYS ECPKI BUILD KEYS MODULE ERRORS                                                                   *
*************************************************************************************************************/
#define CRYS_ECPKI_BUILD_KEY_INVALID_COMPRESSION_MODE_ERROR     (CRYS_ECPKI_MODULE_ERROR_BASE + 0x07UL)
#define CRYS_ECPKI_BUILD_KEY_ILLEGAL_DOMAIN_ID_ERROR            (CRYS_ECPKI_MODULE_ERROR_BASE + 0x08UL)
#define CRYS_ECPKI_BUILD_KEY_INVALID_PRIV_KEY_IN_PTR_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0x09UL)
#define CRYS_ECPKI_BUILD_KEY_INVALID_USER_PRIV_KEY_PTR_ERROR    (CRYS_ECPKI_MODULE_ERROR_BASE + 0x0AUL)
#define CRYS_ECPKI_BUILD_KEY_INVALID_PRIV_KEY_SIZE_ERROR        (CRYS_ECPKI_MODULE_ERROR_BASE + 0x0BUL)
#define CRYS_ECPKI_BUILD_KEY_INVALID_PRIV_KEY_DATA_ERROR        (CRYS_ECPKI_MODULE_ERROR_BASE + 0x0CUL)
#define CRYS_ECPKI_BUILD_KEY_INVALID_PUBL_KEY_IN_PTR_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0x0DUL)
#define CRYS_ECPKI_BUILD_KEY_INVALID_USER_PUBL_KEY_PTR_ERROR    (CRYS_ECPKI_MODULE_ERROR_BASE + 0x0EUL)
#define CRYS_ECPKI_BUILD_KEY_INVALID_PUBL_KEY_SIZE_ERROR        (CRYS_ECPKI_MODULE_ERROR_BASE + 0x0FUL)
#define CRYS_ECPKI_BUILD_KEY_INVALID_PUBL_KEY_DATA_ERROR        (CRYS_ECPKI_MODULE_ERROR_BASE + 0x10UL)
#define CRYS_ECPKI_BUILD_KEY_INVALID_CHECK_MODE_ERROR           (CRYS_ECPKI_MODULE_ERROR_BASE + 0x11UL)
#define CRYS_ECPKI_BUILD_KEY_INVALID_TEMP_BUFF_PTR_ERROR        (CRYS_ECPKI_MODULE_ERROR_BASE + 0x12UL)
#define CRYS_ECPKI_BUILD_KEY_UNCOMPRESSION_ERROR                (CRYS_ECPKI_MODULE_ERROR_BASE + 0x13UL)

/* The CRYS ECPKI EXPORT PUBLIC KEY MODULE ERRORS */
#define CRYS_ECPKI_EXPORT_PUBL_KEY_INVALID_USER_PUBL_KEY_PTR_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0x14UL)
#define CRYS_ECPKI_EXPORT_PUBL_KEY_ILLEGAL_COMPRESSION_MODE_ERROR       (CRYS_ECPKI_MODULE_ERROR_BASE + 0x15UL)
#define CRYS_ECPKI_EXPORT_PUBL_KEY_INVALID_EXTERN_PUBL_KEY_PTR_ERROR    (CRYS_ECPKI_MODULE_ERROR_BASE + 0x16UL)
#define CRYS_ECPKI_EXPORT_PUBL_KEY_INVALID_PUBL_KEY_SIZE_PTR_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0x17UL)
#define CRYS_ECPKI_EXPORT_PUBL_KEY_INVALID_PUBL_KEY_SIZE_ERROR          (CRYS_ECPKI_MODULE_ERROR_BASE + 0x18UL)
#define CRYS_ECPKI_EXPORT_PUBL_KEY_ILLEGAL_DOMAIN_ID_ERROR              (CRYS_ECPKI_MODULE_ERROR_BASE + 0x19UL)
#define CRYS_ECPKI_EXPORT_PUBL_KEY_ILLEGAL_VALIDATION_TAG_ERROR         (CRYS_ECPKI_MODULE_ERROR_BASE + 0x1AUL)

/* The CRYS ECPKI BUILD ECC DOMAIN ERRORS */
#define CRYS_ECPKI_BUILD_DOMAIN_ID_IS_NOT_VALID_ERROR	         (CRYS_ECPKI_MODULE_ERROR_BASE + 0x20UL)
#define CRYS_ECPKI_BUILD_DOMAIN_DOMAIN_PTR_ERROR                 (CRYS_ECPKI_MODULE_ERROR_BASE + 0x21UL)
#define CRYS_ECPKI_BUILD_DOMAIN_EC_PARAMETR_PTR_ERROR            (CRYS_ECPKI_MODULE_ERROR_BASE + 0x22UL)
#define CRYS_ECPKI_BUILD_DOMAIN_EC_PARAMETR_SIZE_ERROR           (CRYS_ECPKI_MODULE_ERROR_BASE + 0x23UL)
#define CRYS_ECPKI_BUILD_DOMAIN_COFACTOR_PARAMS_ERROR            (CRYS_ECPKI_MODULE_ERROR_BASE + 0x24UL)
#define CRYS_ECPKI_BUILD_DOMAIN_SECURITY_STRENGTH_ERROR          (CRYS_ECPKI_MODULE_ERROR_BASE + 0x25UL)

#define CRYS_ECPKI_BUILD_SCA_RESIST_ILLEGAL_MODE_ERROR           (CRYS_ECPKI_MODULE_ERROR_BASE + 0x26UL)


/************************************************************************************************************
 * CRYS EC DIFFIE-HELLMAN MODULE ERRORS
*************************************************************************************************************/
/* The CRYS EC SVDP_DH Function errors */
#define CRYS_ECDH_SVDP_DH_INVALID_PARTNER_PUBL_KEY_PTR_ERROR	              (CRYS_ECPKI_MODULE_ERROR_BASE + 0x31UL)
#define CRYS_ECDH_SVDP_DH_PARTNER_PUBL_KEY_VALID_TAG_ERROR	              (CRYS_ECPKI_MODULE_ERROR_BASE + 0x32UL)
#define CRYS_ECDH_SVDP_DH_INVALID_USER_PRIV_KEY_PTR_ERROR		      (CRYS_ECPKI_MODULE_ERROR_BASE + 0x33UL)
#define CRYS_ECDH_SVDP_DH_USER_PRIV_KEY_VALID_TAG_ERROR		              (CRYS_ECPKI_MODULE_ERROR_BASE + 0x34UL)
#define CRYS_ECDH_SVDP_DH_INVALID_SHARED_SECRET_VALUE_PTR_ERROR	              (CRYS_ECPKI_MODULE_ERROR_BASE + 0x35UL)
#define CRYS_ECDH_SVDP_DH_INVALID_TEMP_DATA_PTR_ERROR                         (CRYS_ECPKI_MODULE_ERROR_BASE + 0x36UL)
#define CRYS_ECDH_SVDP_DH_INVALID_SHARED_SECRET_VALUE_SIZE_PTR_ERROR          (CRYS_ECPKI_MODULE_ERROR_BASE + 0x37UL)
#define CRYS_ECDH_SVDP_DH_INVALID_SHARED_SECRET_VALUE_SIZE_ERROR              (CRYS_ECPKI_MODULE_ERROR_BASE + 0x38UL)
#define CRYS_ECDH_SVDP_DH_ILLEGAL_DOMAIN_ID_ERROR                             (CRYS_ECPKI_MODULE_ERROR_BASE + 0x39UL)
#define CRYS_ECDH_SVDP_DH_NOT_CONCENT_PUBL_AND_PRIV_DOMAIN_ID_ERROR           (CRYS_ECPKI_MODULE_ERROR_BASE + 0x3AUL)


/************************************************************************************************************
 * CRYS ECDSA  MODULE ERRORS
 ************************************************************************************************************/
/* The CRYS ECDSA Signing  errors */
#define CRYS_ECDSA_SIGN_INVALID_DOMAIN_ID_ERROR			(CRYS_ECPKI_MODULE_ERROR_BASE + 0x50UL)
#define CRYS_ECDSA_SIGN_INVALID_USER_CONTEXT_PTR_ERROR 	        (CRYS_ECPKI_MODULE_ERROR_BASE + 0x51UL)
#define CRYS_ECDSA_SIGN_INVALID_USER_PRIV_KEY_PTR_ERROR         (CRYS_ECPKI_MODULE_ERROR_BASE + 0x52UL)
#define CRYS_ECDSA_SIGN_ILLEGAL_HASH_OP_MODE_ERROR              (CRYS_ECPKI_MODULE_ERROR_BASE + 0x53UL)
#define CRYS_ECDSA_SIGN_INVALID_MESSAGE_DATA_IN_PTR_ERROR       (CRYS_ECPKI_MODULE_ERROR_BASE + 0x54UL)
#define CRYS_ECDSA_SIGN_INVALID_MESSAGE_DATA_IN_SIZE_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0x55UL)
#define CRYS_ECDSA_SIGN_USER_CONTEXT_VALIDATION_TAG_ERROR       (CRYS_ECPKI_MODULE_ERROR_BASE + 0x57UL)
#define CRYS_ECDSA_SIGN_USER_PRIV_KEY_VALIDATION_TAG_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0x58UL)
#define CRYS_ECDSA_SIGN_INVALID_SIGNATURE_OUT_PTR_ERROR         (CRYS_ECPKI_MODULE_ERROR_BASE + 0x60UL)
#define CRYS_ECDSA_SIGN_INVALID_SIGNATURE_OUT_SIZE_PTR_ERROR    (CRYS_ECPKI_MODULE_ERROR_BASE + 0x61UL)
#define CRYS_ECDSA_SIGN_INVALID_SIGNATURE_OUT_SIZE_ERROR        (CRYS_ECPKI_MODULE_ERROR_BASE + 0x62UL)
#define CRYS_ECDSA_SIGN_INVALID_IS_EPHEMER_KEY_INTERNAL_ERROR   (CRYS_ECPKI_MODULE_ERROR_BASE + 0x63UL)
#define CRYS_ECDSA_SIGN_INVALID_EPHEMERAL_KEY_PTR_ERROR         (CRYS_ECPKI_MODULE_ERROR_BASE + 0x64UL)
#define CRYS_ECDSA_SIGN_INVALID_RND_CONTEXT_PTR_ERROR           (CRYS_ECPKI_MODULE_ERROR_BASE + 0x65UL)
#define CRYS_ECDSA_SIGN_INVALID_RND_FUNCTION_PTR_ERROR          (CRYS_ECPKI_MODULE_ERROR_BASE + 0x66UL)

/* The CRYS ECDSA Verifying  errors */
#define CRYS_ECDSA_VERIFY_INVALID_DOMAIN_ID_ERROR		(CRYS_ECPKI_MODULE_ERROR_BASE + 0x70UL)
#define CRYS_ECDSA_VERIFY_INVALID_USER_CONTEXT_PTR_ERROR	(CRYS_ECPKI_MODULE_ERROR_BASE + 0x71UL)
#define CRYS_ECDSA_VERIFY_INVALID_SIGNER_PUBL_KEY_PTR_ERROR     (CRYS_ECPKI_MODULE_ERROR_BASE + 0x72UL)
#define CRYS_ECDSA_VERIFY_ILLEGAL_HASH_OP_MODE_ERROR            (CRYS_ECPKI_MODULE_ERROR_BASE + 0x73UL)
#define CRYS_ECDSA_VERIFY_INVALID_SIGNATURE_IN_PTR_ERROR        (CRYS_ECPKI_MODULE_ERROR_BASE + 0x76UL)
#define CRYS_ECDSA_VERIFY_INVALID_SIGNATURE_SIZE_ERROR   	(CRYS_ECPKI_MODULE_ERROR_BASE + 0x77UL)
#define CRYS_ECDSA_VERIFY_INVALID_MESSAGE_DATA_IN_PTR_ERROR     (CRYS_ECPKI_MODULE_ERROR_BASE + 0x80UL)
#define CRYS_ECDSA_VERIFY_INVALID_MESSAGE_DATA_IN_SIZE_ERROR    (CRYS_ECPKI_MODULE_ERROR_BASE + 0x81UL)
#define CRYS_ECDSA_VERIFY_USER_CONTEXT_VALIDATION_TAG_ERROR     (CRYS_ECPKI_MODULE_ERROR_BASE + 0x82UL)
#define CRYS_ECDSA_VERIFY_SIGNER_PUBL_KEY_VALIDATION_TAG_ERROR  (CRYS_ECPKI_MODULE_ERROR_BASE + 0x83UL)
#define CRYS_ECDSA_VERIFY_INCONSISTENT_VERIFY_ERROR             (CRYS_ECPKI_MODULE_ERROR_BASE + 0x84UL)


/************************************************************************************************************
 * CRYS EC ELGAMAL  MODULE ERRORS
 ************************************************************************************************************/
/* The CRYS EC ELGAMAL Encrypt function errors */
#define CRYS_EC_ELGAMAL_ENCR_INVALID_DOMAIN_ID_ERROR		     (CRYS_ECPKI_MODULE_ERROR_BASE + 0xB1UL)
#define CRYS_EC_ELGAMAL_ENCR_INVALID_RECEIVER_PUBL_KEY_PTR_ERROR     (CRYS_ECPKI_MODULE_ERROR_BASE + 0xB2UL)
#define CRYS_EC_ELGAMAL_ENCR_INVALID_MESSAGE_DATA_IN_PTR_ERROR       (CRYS_ECPKI_MODULE_ERROR_BASE + 0xB3UL)
#define CRYS_EC_ELGAMAL_ENCR_INVALID_MESSAGE_DATA_IN_SIZE_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0xB4UL)
#define CRYS_EC_ELGAMAL_ENCR_INVALID_ENCR_MESSAGE_OUT_PTR_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0xB5UL)
#define CRYS_EC_ELGAMAL_ENCR_INVALID_ENCR_MESS_OUT_SIZE_PTR_ERROR    (CRYS_ECPKI_MODULE_ERROR_BASE + 0xB6UL)
#define CRYS_EC_ELGAMAL_ENCR_INVALID_ENCR_MESSAGE_OUT_SIZE_ERROR     (CRYS_ECPKI_MODULE_ERROR_BASE + 0xB7UL)
#define CRYS_EC_ELGAMAL_ENCR_INVALID_TEMP_DATA_BUFFER_PTR_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0xB8UL)
#define CRYS_EC_ELGAMAL_RECEIVER_PUBL_KEY_VALIDATION_TAG_ERROR       (CRYS_ECPKI_MODULE_ERROR_BASE + 0xB9UL)
#define CRYS_EC_ELGAMAL_ENCR_INVALID_EPHEMERAL_KEY_DATA_ERROR        (CRYS_ECPKI_MODULE_ERROR_BASE + 0xBAUL)
#define CRYS_EC_ELGAMAL_ENCR_INVALID_EPHEMERAL_PRIV_KEY_SIZE_ERROR   (CRYS_ECPKI_MODULE_ERROR_BASE + 0xBBUL)

/* The CRYS EC ELGAMAL Decrypt function errors */
#define CRYS_EC_ELGAMAL_DECR_INVALID_DOMAIN_ID_ERROR		     (CRYS_ECPKI_MODULE_ERROR_BASE + 0xC1UL)
#define CRYS_EC_ELGAMAL_DECR_INVALID_RECEIVER_PRIV_KEY_PTR_ERROR     (CRYS_ECPKI_MODULE_ERROR_BASE + 0xC2UL)
#define CRYS_EC_ELGAMAL_DECR_INVALID_ENCR_MESSAGE_IN_PTR_ERROR       (CRYS_ECPKI_MODULE_ERROR_BASE + 0xC3UL)
#define CRYS_EC_ELGAMAL_DECR_INVALID_DECR_MESSAGE_OUT_PTR_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0xC4UL)
#define CRYS_EC_ELGAMAL_DECR_INVALID_TEMP_DATA_BUFFER_PTR_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0xC5UL)
#define CRYS_EC_ELGAMAL_RECEIVER_PRIV_KEY_VALIDATION_TAG_ERROR       (CRYS_ECPKI_MODULE_ERROR_BASE + 0xC6UL)
#define CRYS_EC_ELGAMAL_DECR_INVALID_ENCR_MESSAGE_IN_SIZE_ERROR      (CRYS_ECPKI_MODULE_ERROR_BASE + 0xC7UL)
#define CRYS_EC_ELGAMAL_DECR_INVALID_DECR_MESSAGE_OUT_SIZE_PTR_ERROR (CRYS_ECPKI_MODULE_ERROR_BASE + 0xC8UL)
#define CRYS_EC_ELGAMAL_DECR_INVALID_DECR_MESSAGE_OUT_SIZE_ERROR     (CRYS_ECPKI_MODULE_ERROR_BASE + 0xC9UL)


#define CRYS_ECC_HOST_MSG_GENERAL_RPC_A_ERROR            	     (CRYS_ECPKI_MODULE_ERROR_BASE+0xD0UL)
#define CRYS_ECC_HOST_MSG_GENERAL_RPC_B_ERROR         		     (CRYS_ECPKI_MODULE_ERROR_BASE+0xD1UL)
#define CRYS_ECC_HOST_MSG_GENERAL_RPC_C_ERROR              	     (CRYS_ECPKI_MODULE_ERROR_BASE+0xD2UL)

#define CRYS_ECC_ILLEGAL_PARAMS_ACCORDING_TO_PRIV_ERROR      	     (CRYS_ECPKI_MODULE_ERROR_BASE + 0xD3UL)

#define CRYS_ECC_ILLEGAL_HASH_MODE_ERROR      	     		     (CRYS_ECPKI_MODULE_ERROR_BASE + 0xE0UL)


/************************************************************************************************************
 * CRYS ECPKI MODULE  COMMON ERRORS
*************************************************************************************************************/
#define CRYS_ECPKI_INVALID_RND_FUNC_PTR_ERROR                   (CRYS_ECPKI_MODULE_ERROR_BASE + 0x90UL)
#define CRYS_ECPKI_INVALID_RND_CTX_PTR_ERROR                    (CRYS_ECPKI_MODULE_ERROR_BASE + 0x91UL)
#define CRYS_ECPKI_INVALID_DOMAIN_ID_ERROR                      (CRYS_ECPKI_MODULE_ERROR_BASE + 0x92UL)
#define CRYS_ECPKI_INVALID_PRIV_KEY_TAG_ERROR                   (CRYS_ECPKI_MODULE_ERROR_BASE + 0x93UL)
#define CRYS_ECPKI_INVALID_PUBL_KEY_TAG_ERROR                   (CRYS_ECPKI_MODULE_ERROR_BASE + 0x94UL)
#define CRYS_ECPKI_INVALID_DATA_IN_PASSED_STRUCT_ERROR          (CRYS_ECPKI_MODULE_ERROR_BASE + 0x95UL)

/************************************************************************************************************
 * CRYS ECIES MODULE ERRORS
*************************************************************************************************************/
#define CRYS_ECIES_INVALID_PUBL_KEY_PTR_ERROR                   (CRYS_ECPKI_MODULE_ERROR_BASE + 0xE0UL)
#define CRYS_ECIES_INVALID_PUBL_KEY_TAG_ERROR			(CRYS_ECPKI_MODULE_ERROR_BASE + 0xE1UL)
#define CRYS_ECIES_INVALID_PRIV_KEY_PTR_ERROR                   (CRYS_ECPKI_MODULE_ERROR_BASE + 0xE2UL)
#define CRYS_ECIES_INVALID_PRIV_KEY_TAG_ERROR			(CRYS_ECPKI_MODULE_ERROR_BASE + 0xE3UL)
#define CRYS_ECIES_INVALID_PRIV_KEY_VALUE_ERROR			(CRYS_ECPKI_MODULE_ERROR_BASE + 0xE4UL)
#define CRYS_ECIES_INVALID_KDF_DERIV_MODE_ERROR	    		(CRYS_ECPKI_MODULE_ERROR_BASE + 0xE5UL)
#define CRYS_ECIES_INVALID_KDF_HASH_MODE_ERROR			(CRYS_ECPKI_MODULE_ERROR_BASE + 0xE6UL)
#define CRYS_ECIES_INVALID_SECRET_KEY_PTR_ERROR 		(CRYS_ECPKI_MODULE_ERROR_BASE + 0xE7UL)
#define CRYS_ECIES_INVALID_SECRET_KEY_SIZE_ERROR 		(CRYS_ECPKI_MODULE_ERROR_BASE + 0xE8UL)
#define CRYS_ECIES_INVALID_CIPHER_DATA_PTR_ERROR 		(CRYS_ECPKI_MODULE_ERROR_BASE + 0xE9UL)
#define CRYS_ECIES_INVALID_CIPHER_DATA_SIZE_PTR_ERROR 		(CRYS_ECPKI_MODULE_ERROR_BASE + 0xEAUL)
#define CRYS_ECIES_INVALID_CIPHER_DATA_SIZE_ERROR 		(CRYS_ECPKI_MODULE_ERROR_BASE + 0xEBUL)
#define CRYS_ECIES_INVALID_TEMP_DATA_PTR_ERROR 			(CRYS_ECPKI_MODULE_ERROR_BASE + 0xECUL)
#define CRYS_ECIES_INVALID_EPHEM_KEY_PAIR_PTR_ERROR             (CRYS_ECPKI_MODULE_ERROR_BASE + 0xEDUL)

/************************ Enums ********************************/

/************************ Typedefs  ****************************/

/************************ Structs  ******************************/

/************************ Public Variables **********************/

/************************ Public Functions **********************/

#ifdef __cplusplus
}
#endif

#endif


