/**
*   @file       Crypto_KeyManagement.c
*   @implements Crypto_KeyManagement.c_Artifact
*   @version    1.0.0
*   @brief      AUTOSAR Crypto - Cryptographic Services Engine (CRYPTO) functions
*   @details    Contains functions for accessing CRYPTO from the CRYPTO driver perspective
*
*   @addtogroup  Crypto
*   @{
*/
/*==================================================================================================
*   Project              : AUTOSAR 4.3 MCAL
*   Platform             : PA
*   Peripheral           : Crypto
*   Dependencies         : none
*
*   Autosar Version      : 4.3.1
*   Autosar Revision     : ASR_REL_4_3_REV_0001
*   Autosar Conf.Variant :
*   SW Version           : 1.0.0
*   Build Version        : MPC5777C_MCAL_1_0_0_RTM_ASR_REL_4_3_REV_0001_20190315
*
*   (c) Copyright 2006-2016 Freescale Semiconductor, Inc. 
*       Copyright 2017-2019 NXP
*   All Rights Reserved.
==================================================================================================*/
/*==================================================================================================
==================================================================================================*/

#ifdef __cplusplus
extern "C"{
#endif

/**
* @page misra_violations MISRA-C:2012 violations
*
* @section [global]
*          Violates MISRA 2012 Required Rule 5.1, External identifiers shall be distinct.
*          The used compilers use more than 31 chars for identifiers.
*
* @section [global]
*          Violates MISRA 2012 Required Rule 5.2, Identifiers declared in the same scope and name space shall be distinct.
*          The used compilers use more than 31 chars for identifiers.
*
* @section [global]
*          Violates MISRA 2012 Required Rule 5.4, Macro identifiers shall be distinct.
*          The used compilers use more than 31 chars for identifiers.
*
* @section [global]
*          Violates MISRA 2012 Required Rule 5.5, Identifiers shall be distinct from macro names.
*          The used compilers use more than 31 chars for identifiers.
*/

/*==================================================================================================
*                                        INCLUDE FILES
* 1) system and project includes
* 2) needed interfaces from external units
* 3) internal and external interfaces from this unit
==================================================================================================*/
#include "Crypto.h"
#include "CryIf_Cbk.h"
#include "Crypto_KeyManagement.h"

/*==================================================================================================
*                                       SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define CRYPTO_KEY_MANAGEMENT_VENDOR_ID_C                     43
#define CRYPTO_KEY_MANAGEMENT_AR_RELEASE_MAJOR_VERSION_C      4
#define CRYPTO_KEY_MANAGEMENT_AR_RELEASE_MINOR_VERSION_C      3
#define CRYPTO_KEY_MANAGEMENT_AR_RELEASE_REVISION_VERSION_C   1
#define CRYPTO_KEY_MANAGEMENT_SW_MAJOR_VERSION_C              1
#define CRYPTO_KEY_MANAGEMENT_SW_MINOR_VERSION_C              0
#define CRYPTO_KEY_MANAGEMENT_SW_PATCH_VERSION_C              0

/*==================================================================================================
*                                      FILE VERSION CHECKS
==================================================================================================*/
/* Check if Crypto key management source file and Crypto header file are of the same vendor */
#if (CRYPTO_KEY_MANAGEMENT_VENDOR_ID_C != CRYPTO_VENDOR_ID)
    #error "Crypto_KeyManagement.c and Crypto.h have different vendor ids"
#endif

/* Check if Crypto key management source file and Crypto header file are of the same Autosar version */
#if ((CRYPTO_KEY_MANAGEMENT_AR_RELEASE_MAJOR_VERSION_C    != CRYPTO_AR_RELEASE_MAJOR_VERSION) || \
     (CRYPTO_KEY_MANAGEMENT_AR_RELEASE_MINOR_VERSION_C    != CRYPTO_AR_RELEASE_MINOR_VERSION) || \
     (CRYPTO_KEY_MANAGEMENT_AR_RELEASE_REVISION_VERSION_C != CRYPTO_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Crypto_KeyManagement.c and Crypto.h are different"
#endif

/* Check if Crypto key management source file and Crypto header file are of the same Software version */
#if ((CRYPTO_KEY_MANAGEMENT_SW_MAJOR_VERSION_C != CRYPTO_SW_MAJOR_VERSION) || \
     (CRYPTO_KEY_MANAGEMENT_SW_MINOR_VERSION_C != CRYPTO_SW_MINOR_VERSION) || \
     (CRYPTO_KEY_MANAGEMENT_SW_PATCH_VERSION_C != CRYPTO_SW_PATCH_VERSION)    \
    )
    #error "Software Version Numbers of Crypto_KeyManagement.c and Crypto.h are different"
#endif

/* Check if Crypto key management source file and Crypto key management header file are of the same vendor */
#if (CRYPTO_KEY_MANAGEMENT_VENDOR_ID_C != CRYPTO_KEY_MANAGEMENT_VENDOR_ID)
    #error "Crypto_KeyManagement.c and Crypto_KeyManagement.h have different vendor ids"
#endif

/* Check if Crypto key management source file and Crypto key management header file are of the same Autosar version */
#if ((CRYPTO_KEY_MANAGEMENT_AR_RELEASE_MAJOR_VERSION_C    != CRYPTO_KEY_MANAGEMENT_AR_RELEASE_MAJOR_VERSION) || \
     (CRYPTO_KEY_MANAGEMENT_AR_RELEASE_MINOR_VERSION_C    != CRYPTO_KEY_MANAGEMENT_AR_RELEASE_MINOR_VERSION) || \
     (CRYPTO_KEY_MANAGEMENT_AR_RELEASE_REVISION_VERSION_C != CRYPTO_KEY_MANAGEMENT_AR_RELEASE_REVISION_VERSION) \
    )
    #error "AutoSar Version Numbers of Crypto_KeyManagement.c and Crypto_KeyManagement.h are different"
#endif

/* Check if Crypto key management source file and Crypto key management header file are of the same Software version */
#if ((CRYPTO_KEY_MANAGEMENT_SW_MAJOR_VERSION_C != CRYPTO_KEY_MANAGEMENT_SW_MAJOR_VERSION) || \
     (CRYPTO_KEY_MANAGEMENT_SW_MINOR_VERSION_C != CRYPTO_KEY_MANAGEMENT_SW_MINOR_VERSION) || \
     (CRYPTO_KEY_MANAGEMENT_SW_PATCH_VERSION_C != CRYPTO_KEY_MANAGEMENT_SW_PATCH_VERSION)    \
    )
    #error "Software Version Numbers of Crypto_KeyManagement.c and Crypto_KeyManagement.h are different"
#endif

#ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
    /* Check if Crypto key management source file and CryIf callback header file are of the same AutoSar version */
    #if ((CRYPTO_KEY_MANAGEMENT_AR_RELEASE_MAJOR_VERSION_C != CRYIF_CBK_AR_RELEASE_MAJOR_VERSION) || \
         (CRYPTO_KEY_MANAGEMENT_AR_RELEASE_MINOR_VERSION_C != CRYIF_CBK_AR_RELEASE_MINOR_VERSION)    \
        )
        #error "AutoSar Version Numbers of Crypto_KeyManagement.c and CryIf_Cbk.h are different"
    #endif 
#endif

/*==================================================================================================
*                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
==================================================================================================*/

/*==================================================================================================
*                                       LOCAL MACROS
==================================================================================================*/

/*==================================================================================================
*                                      LOCAL CONSTANTS
==================================================================================================*/

/*==================================================================================================
*                                      LOCAL VARIABLES
==================================================================================================*/

/*==================================================================================================
*                                      GLOBAL CONSTANTS
==================================================================================================*/

/*==================================================================================================
*                                      GLOBAL VARIABLES
==================================================================================================*/

/*==================================================================================================
*                                   LOCAL FUNCTION PROTOTYPES
==================================================================================================*/

/*==================================================================================================
*                                      LOCAL FUNCTIONS
==================================================================================================*/

/*==================================================================================================
*                                       GLOBAL FUNCTIONS
==================================================================================================*/

#ifdef __cplusplus
}
#endif

/** @} */
